diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2012-08-01 16:59:17 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2012-08-01 16:59:17 -0400 |
commit | 0c1086c6a41884352356f0d4822c95080e0caad6 (patch) | |
tree | b418474812d933094e6fffbd660f3fbe35f5aff1 /passlib/ext | |
parent | 432fd93f6884036df59007f09dee86adfb7078ad (diff) | |
download | passlib-0c1086c6a41884352356f0d4822c95080e0caad6.tar.gz |
large number of assorted documentation updates
Diffstat (limited to 'passlib/ext')
-rw-r--r-- | passlib/ext/django/models.py | 4 | ||||
-rw-r--r-- | passlib/ext/django/utils.py | 12 |
2 files changed, 10 insertions, 6 deletions
diff --git a/passlib/ext/django/models.py b/passlib/ext/django/models.py index e3938aa..4fb6aea 100644 --- a/passlib/ext/django/models.py +++ b/passlib/ext/django/models.py @@ -111,6 +111,7 @@ def _apply_patch(): def set_password(user, password): "passlib replacement for User.set_password()" if is_valid_secret(password): + # NOTE: pulls _get_category from module globals cat = _get_category(user) user.password = password_context.encrypt(password, category=cat) else: @@ -122,6 +123,7 @@ def _apply_patch(): hash = user.password if not is_valid_secret(password) or not is_password_usable(hash): return False + # NOTE: pulls _get_category from module globals cat = _get_category(user) ok, new_hash = password_context.verify_and_update(password, hash, category=cat) @@ -266,6 +268,8 @@ def _load(): _apply_patch() password_context.load(config) if get_category: + # NOTE: _get_category is module global which is read by + # monkeypatched functions constructed by _apply_patch() _get_category = get_category log.debug("passlib.ext.django loaded") diff --git a/passlib/ext/django/utils.py b/passlib/ext/django/utils.py index 098dbe4..3c03637 100644 --- a/passlib/ext/django/utils.py +++ b/passlib/ext/django/utils.py @@ -96,12 +96,12 @@ 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 -# is the one being used) +# prefix used to shoehorn passlib's handler names into django hasher namespace; +# allows get_hasher() to be meaningfully called even if passlib handler +# is the one being used. PASSLIB_HASHER_PREFIX = "passlib_" -# prefix all the django-specific hash formats are stored under. +# prefix all the django-specific hash formats are stored under w/in passlib; # all of these hashes should expose their hasher name via ``.django_name``. DJANGO_PASSLIB_PREFIX = "django_" @@ -125,7 +125,7 @@ def hasher_to_passlib_name(hasher_name): if getattr(handler, "django_name", None) == hasher_name: return name # XXX: this should only happen for custom hashers that have been registered. - # work in progress (below) that would take care of those. + # _HasherHandler (below) is work in progress that would fix this. raise ValueError("can't translate hasher name to passlib name: %r" % hasher_name) @@ -147,7 +147,7 @@ class _HasherWrapper(object): def salt(self): # XXX: our encode wrapper generates a new salt each time it's called, - # so just returning an 'no value' flag here. + # so just returning a 'no value' flag here. return _FAKE_SALT def verify(self, password, encoded): |