summaryrefslogtreecommitdiff
path: root/passlib/utils/compat.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge from defaultironpython-support-devEli Collins2012-04-171-5/+5
|\
| * disabling saslprep() support under Jython - it lacks the stringprep moduleEli Collins2012-04-171-0/+6
| |
| * assorted bugfixes, tweaks, and tests added; based on coverage examinationEli Collins2012-04-121-5/+5
| | | | | | | | | | | | | | * test os_crypt backend has functional fallback * test handler methods accept all unicode/bytes combinations for secret & hash * fixed some incorrect error messages & types being caught & raised * other minor cleanups
* | wrote out all the known issues; made an attempt at deal w/ unicode-v-bytes ↵Eli Collins2012-04-121-21/+85
|/ | | | issues, will try again some other time
* clarify behavior for secret=None and hash=NoneEli Collins2012-04-111-4/+7
| | | | | | | | | | | | | | | | | | | | | | | * passing a non-string secret or non-string hash to any CryptContext or handler method will now reliably result in a TypeError. previously, passing hash=None to many handler identify() and verify() methods would return False, while others would raise a TypeError. other handler methods would alternately throw ValueError or TypeError when passed a value that wasn't unicode or bytes. the various CryptContext methods also behaved inconsistently, depending on the behavior of the underlying handler. all of these behaviors are gone, they should all raise the same TypeError. * redid many of the from_string() methods to verify the hash type. * moved secret type & size validation to GenericHandler's encrypt/genhash/verify methods. this cheaply made the secret validation global to all hashes, and lets _calc_digest() implementations trust that the secret is valid. * updated the CryptContext and handler unittests to verify the above behavior is adhered to.
* updated test support & py3 compat code from an external libraryEli Collins2012-03-121-84/+94
| | | | | | | | | | | | | | | | passlib.tests ------------- * deprecated support for unittest 1... accumulated too many backports, planning to require unittest2 in next release. * case_prefix renamed to shortDescription * test case now archives & clears warning registry state in addition to warning filter state passlib.utils.compat -------------------- * a bunch of the bytes-related functions were renamed for clarity * NativeStringIO alias added * trange alias merged into irange
* added support for Cisco PIX & Type 7 hashesEli Collins2012-03-101-0/+18
| | | | | | | | * Cisco Type 5 appears to be same as md5_crypt * added requires_user=False support to HandlerCase * added more through salt-generation test (since cisco_pix has only 4 bits of salt) * added HandlerCase test to ensure user is used as salt
* misc bugfixes from round of changesEli Collins2012-01-181-31/+99
| | | | | | | | | * added str_to_[ub]ascii to wrap hexdigest() calls * fixed some h64big calls I missed * some py3 fixes * removed utils.compat.aliases, using overlay to replace real compat module instead (to agree w/ imports already in code)
* import cleanupsEli Collins2012-01-181-24/+91
| | | | | | | | | | | | | | | * moved bytes compat functions from utils to utils.compat (bord, bjoin, bjoin_ints, bjoin_elems, ujoin) * renamed bord -> belem_ord for clarify * a bunch of to_native_str() always use ascii, and have fixed input types (always bytes or always unicode). these don't need overhead of to_native_str(), so replaced those calls with two new funcs: compat.bascii_to_str() / compat.uascii_to_str() * cleaned up a lot of imports from utils/utils.compat to pull from correct module * simplified the to_string() logic of a bunch of handlers to reduce unicode<->byte transitions
* cleanups to utilsEli Collins2012-01-181-15/+0
|
* lots of work on scram hashEli Collins2012-01-091-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | handler ------- * added 'scram' to default registry list * handler 'algs' keyword now parsed & validated correctly * digest names normalized -> IANA spec * saslprep() integrated into code * added config string format related ------- * added documentation (still needs cleaning up though) * added majority of UTs, still need to add a few edge cases other ----- * redid context->handler deprecation link - code now looks for handler._deprecated_detector(settings) to generate a callable, should be more efficient, and allow errors to be throw at bind-time instead of call-time. * pbkdf2() function now treats keylen = -1 as request for keylen = PRF digest size.
* move vm constants to compat moduleEli Collins2011-12-281-0/+4
|
* misc fixes for py3 compatEli Collins2011-12-281-2/+4
|
* typofixEli Collins2011-12-091-1/+1
|
* couple of minor tweaks - basic unittests pass 2.7 & 3.2Eli Collins2011-12-061-7/+20
|
* replaced all #Py3k# conditional includesEli Collins2011-12-061-3/+8
|
* added compat.aliased lazy-loading module, aliases for BytesIO/StringIOEli Collins2011-12-061-4/+48
|
* added print() aliasEli Collins2011-12-061-0/+49
|
* moved sys_bits to compat, added exc_err, removed utils.py32_langEli Collins2011-12-061-5/+20
|
* added compat.sb_types for testing isinstance(obj,(bytes,unicode))Eli Collins2011-12-061-0/+2
|
* added get_method_function() to alias meth.im_func / meth.__func__Eli Collins2011-12-061-0/+10
|
* replaced (int,long) instance checks with compat.int_typesEli Collins2011-12-061-0/+5
|
* added callable shim for 3.0-3.1Eli Collins2011-12-061-13/+12
|
* replaced xrange() instances with compat.irange() aliasEli Collins2011-12-061-0/+2
|
* added compatibility module (passlib.utils.compat)Eli Collins2011-12-061-0/+96
exports specialized range & map aliases, and some dict helpers * all dict.iteritems() calls replaced with compat.iteritems(dict) * all xrange() calls replaced with compat.irange() * all range() calls replaced with compat.trange() and compat.lrange() as appropriate * all map() calls replaced with compat.lmap()