mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-11-16 09:34:03 +01:00
PEP8 fixes
This commit is contained in:
@@ -9,6 +9,7 @@ from django.template import Context, Template
|
||||
|
||||
|
||||
class Command(object):
|
||||
|
||||
"""Base command class
|
||||
|
||||
A valid administrative command must inherit from this class.
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""postfix_maps command."""
|
||||
|
||||
import datetime
|
||||
import getpass
|
||||
import inspect
|
||||
import os
|
||||
import sys
|
||||
import datetime
|
||||
|
||||
from django.template import Context, Template
|
||||
|
||||
from . import Command
|
||||
|
||||
|
||||
class MapFilesGenerator(object):
|
||||
|
||||
def __init__(self, dbinfo=None):
|
||||
"""Constructor.
|
||||
"""
|
||||
"""Constructor."""
|
||||
self.template = Template("""user = {{ dbuser }}
|
||||
password = {{ dbpass }}
|
||||
dbname = {{ dbname }}
|
||||
@@ -69,7 +73,7 @@ query = {{ query|safe }}
|
||||
continue
|
||||
if v is MapFile:
|
||||
continue
|
||||
if not v.category in args.categories:
|
||||
if v.category not in args.categories:
|
||||
continue
|
||||
self.__render_map(args, v)
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ from django.conf.urls import include
|
||||
|
||||
|
||||
class ModoExtension(object):
|
||||
|
||||
"""Base extension class.
|
||||
|
||||
Each Modoboa extension must inherit from this class to be
|
||||
@@ -37,6 +38,7 @@ class ModoExtension(object):
|
||||
|
||||
|
||||
class ExtensionsPool(object):
|
||||
|
||||
"""The extensions manager"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -37,6 +37,7 @@ except ImportError:
|
||||
|
||||
|
||||
class User(PermissionsMixin):
|
||||
|
||||
"""Custom User model.
|
||||
|
||||
It overloads the way passwords are stored into the database. The
|
||||
@@ -114,7 +115,7 @@ class User(PermissionsMixin):
|
||||
load_core_settings()
|
||||
scheme = parameters.get_admin("PASSWORD_SCHEME")
|
||||
|
||||
if type(raw_value) is unicode:
|
||||
if isinstance(raw_value, unicode):
|
||||
raw_value = raw_value.encode("utf-8")
|
||||
return get_password_hasher(scheme.upper())().encrypt(raw_value)
|
||||
|
||||
@@ -146,7 +147,7 @@ class User(PermissionsMixin):
|
||||
match = self.password_expr.match(self.password)
|
||||
if match is None:
|
||||
return False
|
||||
if type(raw_value) is unicode:
|
||||
if isinstance(raw_value, unicode):
|
||||
raw_value = raw_value.encode("utf-8")
|
||||
scheme = match.group(1)
|
||||
val2 = match.group(2)
|
||||
|
||||
@@ -9,6 +9,7 @@ from modoboa.lib import parameters
|
||||
|
||||
|
||||
class MD5CRYPTHasher(PasswordHasher):
|
||||
|
||||
"""
|
||||
MD5-CRYPT password hasher.
|
||||
|
||||
@@ -29,6 +30,7 @@ class MD5CRYPTHasher(PasswordHasher):
|
||||
|
||||
|
||||
class SHA256CRYPTHasher(PasswordHasher):
|
||||
|
||||
"""
|
||||
SHA256-CRYPT password hasher.
|
||||
|
||||
@@ -51,6 +53,7 @@ class SHA256CRYPTHasher(PasswordHasher):
|
||||
|
||||
|
||||
class SHA512CRYPTHasher(PasswordHasher):
|
||||
|
||||
"""
|
||||
SHA512-CRYPT password hasher.
|
||||
|
||||
|
||||
@@ -12,9 +12,11 @@ from django.utils.crypto import constant_time_compare
|
||||
|
||||
|
||||
class PasswordHasher(object):
|
||||
|
||||
"""
|
||||
Base class of all hashers.
|
||||
"""
|
||||
|
||||
def __init__(self, target='local'):
|
||||
self._target = target
|
||||
|
||||
@@ -61,6 +63,7 @@ class PasswordHasher(object):
|
||||
|
||||
|
||||
class PLAINHasher(PasswordHasher):
|
||||
|
||||
"""
|
||||
Plain (ie. clear) password hasher.
|
||||
"""
|
||||
@@ -73,6 +76,7 @@ class PLAINHasher(PasswordHasher):
|
||||
|
||||
|
||||
class CRYPTHasher(PasswordHasher):
|
||||
|
||||
"""
|
||||
crypt password hasher.
|
||||
|
||||
@@ -89,6 +93,7 @@ class CRYPTHasher(PasswordHasher):
|
||||
|
||||
|
||||
class MD5Hasher(PasswordHasher):
|
||||
|
||||
"""
|
||||
MD5 password hasher.
|
||||
|
||||
@@ -104,6 +109,7 @@ class MD5Hasher(PasswordHasher):
|
||||
|
||||
|
||||
class SHA256Hasher(PasswordHasher):
|
||||
|
||||
"""
|
||||
SHA256 password hasher.
|
||||
|
||||
|
||||
@@ -158,6 +158,7 @@ def get_version():
|
||||
|
||||
|
||||
class ConnectedUsers(template.Node):
|
||||
|
||||
def __init__(self, varname):
|
||||
self.varname = varname
|
||||
|
||||
|
||||
Reference in New Issue
Block a user