refactor(api): fix pylint errors

This commit is contained in:
jo 2022-04-01 17:29:11 +02:00 committed by Kyle Robbertze
parent bf8db3e6f0
commit 0bbd46c33f
14 changed files with 159 additions and 169 deletions

View file

@ -59,28 +59,26 @@ class User(AbstractBaseUser):
def get_short_name(self):
return self.first_name
def set_password(self, password):
if not password:
def set_password(self, raw_password):
if not raw_password:
self.set_unusable_password()
else:
self.password = hashlib.md5(password.encode()).hexdigest()
self.password = hashlib.md5(raw_password.encode()).hexdigest()
def is_staff(self):
return self.type == ADMIN
def check_password(self, password):
def check_password(self, raw_password):
if self.has_usable_password():
test_password = hashlib.md5(password.encode()).hexdigest()
test_password = hashlib.md5(raw_password.encode()).hexdigest()
return test_password == self.password
return False
"""
The following methods have to be re-implemented here, as PermissionsMixin
assumes that the User class has a 'group' attribute, which LibreTime does
not currently provide. Once Django starts managing the Database
(managed = True), then this can be replaced with
django.contrib.auth.models.PermissionMixin.
"""
# The following methods have to be re-implemented here, as PermissionsMixin
# assumes that the User class has a 'group' attribute, which LibreTime does
# not currently provide. Once Django starts managing the Database
# (managed = True), then this can be replaced with
# django.contrib.auth.models.PermissionMixin.
def is_superuser(self):
return self.type == ADMIN

View file

@ -1,4 +1,3 @@
from django.apps import apps
from rest_framework.test import APITestCase
from ....permission_constants import GROUPS