summaryrefslogtreecommitdiff
path: root/passlib/ext
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2012-08-01 12:52:39 -0400
committerEli Collins <elic@assurancetechnologies.com>2012-08-01 12:52:39 -0400
commit432fd93f6884036df59007f09dee86adfb7078ad (patch)
tree6b7b702984775a66f73d6831cd2a8749156147ba /passlib/ext
parent189346c45a4907479f083c854469a896dcf3b581 (diff)
downloadpasslib-432fd93f6884036df59007f09dee86adfb7078ad.tar.gz
project-wide whitespace & comment cleanup (it's been a couple of years)
Diffstat (limited to 'passlib/ext')
-rw-r--r--passlib/ext/django/models.py24
-rw-r--r--passlib/ext/django/utils.py32
2 files changed, 28 insertions, 28 deletions
diff --git a/passlib/ext/django/models.py b/passlib/ext/django/models.py
index 55bb4c6..e3938aa 100644
--- a/passlib/ext/django/models.py
+++ b/passlib/ext/django/models.py
@@ -1,7 +1,7 @@
"""passlib.ext.django.models -- monkeypatch django hashing framework"""
-#===================================================================
-#imports
-#===================================================================
+#=============================================================================
+# imports
+#=============================================================================
# core
import logging; log = logging.getLogger(__name__)
from warnings import warn
@@ -17,9 +17,9 @@ from passlib.utils.compat import callable, unicode, bytes
# local
__all__ = ["password_context"]
-#===================================================================
+#=============================================================================
# global attrs
-#===================================================================
+#=============================================================================
# the context object which this patches contrib.auth to use for password hashing.
# configuration controlled by ``settings.PASSLIB_CONFIG``.
@@ -42,9 +42,9 @@ _manager = _PatchManager(log=logging.getLogger(__name__ + "._manager"))
# patch status
_patched = False
-#===================================================================
+#=============================================================================
# applying & removing the patches
-#===================================================================
+#=============================================================================
def _apply_patch():
"""monkeypatch django's password handling to use ``passlib_context``,
assumes the caller will configure the object.
@@ -216,9 +216,9 @@ def _remove_patch():
log.debug("django not monkeypatched")
return False
-#===================================================================
+#=============================================================================
# main code
-#===================================================================
+#=============================================================================
def _load():
global _get_category
@@ -276,6 +276,6 @@ except:
_remove_patch()
raise
-#===================================================================
-#eof
-#===================================================================
+#=============================================================================
+# eof
+#=============================================================================
diff --git a/passlib/ext/django/utils.py b/passlib/ext/django/utils.py
index 72e50ae..098dbe4 100644
--- a/passlib/ext/django/utils.py
+++ b/passlib/ext/django/utils.py
@@ -1,7 +1,7 @@
"""passlib.ext.django.utils - helper functions used by this plugin"""
-#===================================================================
-#imports
-#===================================================================
+#=============================================================================
+# imports
+#=============================================================================
# core
import logging; log = logging.getLogger(__name__)
from weakref import WeakKeyDictionary
@@ -25,9 +25,9 @@ __all__ = [
"get_passlib_hasher",
]
-#===================================================================
+#=============================================================================
# default policies
-#===================================================================
+#=============================================================================
def get_preset_config(name):
"""Returns configuration string for one of the preset strings
supported by the ``PASSLIB_CONFIG`` setting.
@@ -92,9 +92,9 @@ superuser__sha512_crypt__default_rounds = 120000
superuser__django_pbkdf2_sha256__default_rounds = 15000
"""
-#===================================================================
+#=============================================================================
# translating passlib names <-> hasher names
-#===================================================================
+#=============================================================================
# prefix used to shoehorn passlib's handler names into hasher namespace
# (allows get_hasher() to be meaningfully called even if passlib handler
@@ -129,9 +129,9 @@ def hasher_to_passlib_name(hasher_name):
raise ValueError("can't translate hasher name to passlib name: %r" %
hasher_name)
-#===================================================================
+#=============================================================================
# wrapping passlib handlers as django hashers
-#===================================================================
+#=============================================================================
_FAKE_SALT = "--fake-salt--"
class _HasherWrapper(object):
@@ -229,9 +229,9 @@ def _get_hasher(algorithm):
get_hasher = module._manager.getorig("django.contrib.auth.hashers:get_hasher")
return get_hasher(algorithm)
-#===================================================================
+#=============================================================================
# adapting django hashers -> passlib handlers
-#===================================================================
+#=============================================================================
# TODO: this code probably halfway works, mainly just needs
# a routine to read HASHERS and PREFERRED_HASHER.
@@ -322,9 +322,9 @@ def _get_hasher(algorithm):
## register_crypt_handler(handler)
## return handler
-#===================================================================
+#=============================================================================
# monkeypatch helpers
-#===================================================================
+#=============================================================================
# private singleton indicating lack-of-value
_UNSET = object()
@@ -465,6 +465,6 @@ class _PatchManager(object):
# eoc
#===================================================================
-#===================================================================
-#eof
-#===================================================================
+#=============================================================================
+# eof
+#=============================================================================