Current File : //usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyc
�
�5Xc@sdZddlmZmZddlZeje�ZddlZddl	Z	ddl
mZy$ddlm
Zejde�Wn$ek
r�ejd�fZnXddlmZmZdd	lmZdd
lmZddlmZmZmZmZddlmZd
dddgZddfZ idd6dd6dd6dd6Z!d�Z"dZ#dZ$dZ%e&dg�Z'd �Z(d!e)fd"��YZ*d#e*fd$��YZ+d%Z,d&e)fd'��YZ-d(e)fd)��YZ.e)�Z/d*e)fd+��YZ0dS(,s?passlib.ext.django.utils - helper functions used by this plugini����(tupdate_wrappertwrapsN(twarn(tVERSIONsfound django %r installationsdjango installation not found(texctregistry(tCryptContext(tPasslibRuntimeWarning(tget_method_functiont	iteritemstOrderedDicttunicode(tmemoized_propertytDJANGO_VERSIONtMIN_DJANGO_VERSIONtget_preset_configtget_django_hasheriitdjango10_contexts
django-1.0tdjango14_contexts
django-1.4tdjango16_contexts
django-1.6tdjango_contexts
django-latestcCs�|dkr*ts!td��nd}n|dkr:tSyt|}Wn!tk
rktd|��nXddl}t|j|�j�S(seReturns configuration string for one of the preset strings
    supported by the ``PASSLIB_CONFIG`` setting.
    Currently supported presets:

    * ``"passlib-default"`` - default config used by this release of passlib.
    * ``"django-default"`` - config matching currently installed django version.
    * ``"django-latest"`` - config matching newest django version (currently same as ``"django-1.6"``).
    * ``"django-1.0"`` - config used by stock Django 1.0 - 1.3 installs
    * ``"django-1.4"`` - config used by stock Django 1.4 installs
    * ``"django-1.6"`` - config used by stock Django 1.6 installs
    sdjango-defaults9can't resolve django-default preset, django not installeds
django-1.6spasslib-defaultsunknown preset config name: %ri����N(	R
t
ValueErrortPASSLIB_DEFAULTt_preset_maptKeyErrortpasslib.appstgetattrtappst	to_string(tnametattrtpasslib((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR/s	
s�
[passlib]

; list of schemes supported by configuration
; currently all django 1.6, 1.4, and 1.0 hashes,
; and three common modular crypt format hashes.
schemes =
    django_pbkdf2_sha256, django_pbkdf2_sha1, django_bcrypt, django_bcrypt_sha256,
    django_salted_sha1, django_salted_md5, django_des_crypt, hex_md5,
    sha512_crypt, bcrypt, phpass

; default scheme to use for new hashes
default = django_pbkdf2_sha256

; hashes using these schemes will automatically be re-hashed
; when the user logs in (currently all django 1.0 hashes)
deprecated =
    django_pbkdf2_sha1, django_salted_sha1, django_salted_md5,
    django_des_crypt, hex_md5

; sets some common options, including minimum rounds for two primary hashes.
; if a hash has less than this number of rounds, it will be re-hashed.
sha512_crypt__min_rounds = 80000
django_pbkdf2_sha256__min_rounds = 10000

; set somewhat stronger iteration counts for ``User.is_staff``
staff__sha512_crypt__default_rounds = 100000
staff__django_pbkdf2_sha256__default_rounds = 12500

; and even stronger ones for ``User.is_superuser``
superuser__sha512_crypt__default_rounds = 120000
superuser__django_pbkdf2_sha256__default_rounds = 15000
tpasslib_tdjango_thex_md5cst���fd��}|S(s#wrap method object in bare functioncs
�||�S(N((targstkwds(tmethod(s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytwrapper~s(R(R%R&((R%s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt_wrap_method|stDjangoTranslatorcBs�eZdZdZdZdZdZdd�Zd�Z	d�Z
d�Zed�Z
edd�Zd�Zd	�Zed
�Zed�ZRS(
sO
    Object which helps translate passlib hasher objects / names
    to and from django hasher objects / names.

    These methods are wrapped in a class so that results can be cached,
    but with the ability to have independant caches, since django hasher
    names may / may not correspond to the same instance (or even class).
    cKsPtt|�j|�|dk	r.||_ntj�|_tj�|_	dS(N(
tsuperR(t__init__tNonetcontexttweakreftWeakKeyDictionaryt_django_hasher_cachetWeakValueDictionaryt_passlib_hasher_cache(tselfR,R$((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR*�s
cCs'|jj�|jj�d|_dS(N(R/tclearR1R+t_django_unsalted_sha1(R2((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt
reset_hashers�s

cCs3|j}|dkr"tj|�S|j|�SdS(sM
        resolve passlib hasher by name, using context if available.
        N(R,R+Rtget_crypt_handlerthandler(R2tpasslib_nameR,((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt_get_passlib_hasher�s	
cCs|j|�jS(sF
        Convert passlib hasher / name to Django hasher name.
        (tpasslib_to_djangot	algorithm(R2R8((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytpasslib_to_django_name�scCs�t|d�s!|j|�}n|rq|j}y||SWntk
rOnX|j|dt�}||<|St|dd�}|r�|j|�St	|�SdS(s�
        Convert passlib hasher / name to Django hasher.

        :param passlib_hasher:
            passlib hasher / name

        :returns:
            django hasher instance
        Rtcachedtdjango_nameN(
thasattrR9R/RR:tFalseRR+t_create_django_hashert_PasslibHasherWrapper(R2tpasslib_hasherR=tcachetresultR>((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR:�s	

tmd5tMD5PasswordHashercCs�tjjd�}|d	ks+|jjrEddlm}||�S|jjj	d�j
}x$|�D]}|j|krg|SqgW|jj|�}|r�d|kr�d|}nddl
m}||��Std|��d	S(
sf
        helper to create new django hasher by name.
        wraps underlying django methods.
        spasslib.ext.django.modelsi����(t
get_hashers'django.contrib.auth.hashers:get_hasherst.sdjango.contrib.auth.hashers.(t
import_stringsunknown hasher: %rN(tsystmodulestgetR+tadaptertpatchedtdjango.contrib.auth.hashersRHt_managertgetorigt__wrapped__R;t_builtin_django_hasherstdjango.utils.module_loadingRJR(R2R>tmoduleRHtget_hashersthashertpathRJ((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyRA�s


cCs|j|�jS(sF
        Convert Django hasher / name to Passlib hasher name.
        (tdjango_to_passlibR(R2R>((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytdjango_to_passlib_namesc	Cs�t|d�r1t|t�r%|jS|j}n|r�|j}y||SWntk
r_nX|j|dt�}||<|S|j	t
�r�|tt
�}|j|�S|dkr�|j
}|dkr�td��n|j�S|dkr�d}n|j
}|dkr*d�tj�D�}n|jdt�}x*|D]"}t|d	d�|krC|SqCWtd
|f��dS(s�
        Convert Django hasher / name to Passlib hasher / name.
        If present, CryptContext will be checked instead of main registry.

        :param django_name:
            Django hasher class or algorithm name.
            "default" allowed if context provided.

        :raises ValueError:
            if can't resolve hasher.

        :returns:
            passlib hasher or name
        R;R=tdefaults)can't determine default scheme w/ contextt
unsalted_sha1tsha1css9|]/}|jt�s$|tkrtj|�VqdS(N(t
startswithtDJANGO_COMPAT_PREFIXt_other_django_hashesRR6(t.0R8((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pys	<genexpr>SstresolveR>s/can't translate django name to passlib name: %rN(R?t
isinstanceRBtpasslib_handlerR;R1RRZR@R_tPASSLIB_WRAPPER_PREFIXtlenR9R,R+t	TypeErrorR7Rtlist_crypt_handlerstschemestTrueRR(	R2R>R=RDRER8R,t
candidatesR7((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyRZs@	

	
		
cCs�t|d�r|S|j|d|�}|dkr�|jdkr�|sV|j|�S|j}|dkr�|j|�}|_n|S|j|d|�S(sH
        Take in a django algorithm name, return django hasher.
        R;R=R]tdjango_salted_sha1N(R?RZRRAR4R+R:(R2R>R=RCRE((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytresolve_django_hasherjs

	N(t__name__t
__module__t__doc__R+R,R/R4R1R*R5R9R<RkR:tdictRTRAR[RZRn(((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR(�s 				 		!	UtDjangoContextAdaptercBs�eZdZdZdZdZdZeZ	e
Zddd�Zd�Z
d�Zdd�Zd�Zddd�Zddd�Zd	�Zd
�Zd�ZdZd
ZedZdZeddede�feddede�feddfeddfeddfeddfeddfeddfeddfeddfeddfgZd�Zd�Zd�Zd�ZRS( sC
    Object which tries to adapt a Passlib CryptContext object,
    using a Django-hasher compatible API.

    When installed in django, :mod:`!passlib.ext.django` will create
    an instance of this class, and then monkeypatch the appropriate
    methods into :mod:`!django.contrib.auth` and other appropriate places.
    cKstjtd�|_|dkr.t�}ntt|�jd||�|rnt	|�sbt
�||_nddlm
}|�|j�|_ddlm}|jjd�r�tj|�}n||_ddlm}||_tjtd�}td	|�|_dS(
Ns.DjangoContextAdapterR,i����(t	lru_cache(t
make_passwordspasslib.(tis_password_usables.DjangoContextAdapter._managertlog(tloggingt	getLoggerRoRwR+RR)RsR*tcallabletAssertionErrortget_user_categorytdjango.utils.lru_cacheRtRWRPRuRpR_t
_PatchManagertpeek_unpatched_funct_orig_make_passwordRvRQ(R2R,R|R$RtRuRvtmlog((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR*�s"		cCs4ddlm}|dd�tt|�j�dS(sH
        Wrapper to manually reset django's hasher lookup cache
        i����(R5tsettingtPASSWORD_HASHERSN(RPR5R)Rs(R2R5((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR5�s
cCs5|j}g|jjdt�D]}||�^qS(sq
        Passlib replacement for get_hashers() --
        Return list of available django hasher classes
        Rc(R:R,RjRk(R2R:RX((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyRW�s	R\cCs
|j|�S(s^
        Passlib replacement for get_hasher() --
        Return django hasher by name
        (Rn(R2R;((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyRH�scCsV|jj|dtdt�}|jdkrI|jd�rI|jd�S|j|�S(sl
        Passlib replacement for identify_hasher() --
        Identify django hasher based on hash.
        RctrequiredRmssha1$$R](R,tidentifyRkRR_RHR:(R2tencodedR7((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytidentify_hasher�s
cCs�|dkr|jd�S|j|�}d|jkr:n?|jd�r^|jdd�}n|ry|jd|�}n|j|�S(s9
        Passlib replacement for make_password()
        tsaltt	unsalted_tN(R+R�RZtsetting_kwdsR_tusingthash(R2tpasswordR�RXRC((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyRus
cCs�|dks|j|�r tS|j}|j||�}|oD|sK|S|dkrs|j|d|�s�|Sn8|j|�}|j|�r�|j|d|�r�|S||�|S(s:
        Passlib replacement for check_password()
        R\tsecretN(R+RvR@R,tverifytneeds_updateRZR�(R2R�R�tsettert	preferredR,tcorrectRX((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytcheck_passwords	
cCs�|dkrtS|j}|j|�s,tS|j|�}|jj||d|�\}}|r�|dk	r�||_|j�n|S(s?
        Passlib replacement for User.check_password()
        tcategoryN(R+R@R�RvR|R,tverify_and_updatetsave(R2tuserR�R�tcattoktnew_hash((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytuser_check_passwordEs		
cCsG|dkr|j�n*|j|�}|jj|d|�|_dS(s=
        Passlib replacement for User.set_password()
        R�N(R+tset_unusable_passwordR|R,R�R�(R2R�R�R�((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytuser_set_passwordWs
cCs"|jr
dS|jrdSdSdS(s�
        Helper for hashing passwords per-user --
        figure out the CryptContext category for specified Django user object.
        .. note::
            This may be overridden via PASSLIB_GET_CATEGORY django setting
        t	superusertstaffN(tis_superusertis_staffR+(R2R�((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR|as
		sdjango.contrib.auth.hasherssdjango.contrib.auth.modelss:Usersdjango.contrib.auth.formss.check_passwordR�R%s
.set_passwordR�t:R�RuRWRHR�cCs|j}|jr#|jd�tSttkrEtdtf��n|jd�|j}x�|j	D]�}t
|�dkr�|if7}n|\}}}|jd	�r�||7}nt||�}|j
d�r�t|�}n|j||�qeW|j�t|_|jd�tS(
sI
        Install monkeypatch to replace django hasher framework.
        s3monkeypatching already applied, refusing to reapplys(passlib.ext.django requires django >= %ss#preparing to monkeypatch django ...iR�t,R%s"... finished monkeypatching django(R�R�(RwROtwarningR@R
RtRuntimeErrortdebugRQtpatch_locationsRgtendswithRRMR'tpatchR5Rk(R2Rwtmanagertrecordttargettsourcetoptstvalue((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt
install_patch�s.		

	

	
cCs�|j}|j}|jrl|jd�|jdt�|jji�t|_|j	�|jd�tS|j
�r�|jd�|j�|jji�|j	�|jd�tS|jd�tS(s�
        Remove monkeypatch from django hasher framework.
        As precaution in case there are lingering refs to context,
        context object will be wiped.

        .. warning::
            This may cause problems if any other Django modules have imported
            their own copies of the patched functions, though the patched
            code has been designed to throw an error as soon as possible in
            this case.
        s!removing django monkeypatching...tunpatch_conflictss*...finished removing django monkeypatchings-reverting partial monkeypatching of django...sdjango not monkeypatched(RwRQROR�tunpatch_allRkR,tloadR@R5tisactiveR�(R2RwR�((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytremove_patch�s&			
	






cCso|j�|jr;y|j�Wq^|j��q^Xn#|jrTtjd�n|j�tjd�dS(sD
        Load configuration from django, and install patch.
        s.didn't expect monkeypatching would be applied!spasslib.ext.django loadedN(t_load_settingstenabledR�R�RORwterrorR�(R2((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt
load_model�s
	

	
cCs�ddlm}t�}t|d|�}||krLt|d|�}n||krad}n|dkr�tdt�d}n0t|tt	t
f�s�tj|dd��nt|d	d�}|r�t
|�r�tj|d
d	��n|dkr	t|_dS|jjdd�t|t�rFd
|krFt|�}n|rX||_n|jjdd�|jj|�|j�dS(s-
        Update settings from django
        i����(tsettingstPASSLIB_CONFIGtPASSLIB_CONTEXTspasslib-defaults}setting PASSLIB_CONFIG=None is deprecated, and support will be removed in Passlib 1.8, use PASSLIB_CONFIG='disabled' instead.tdisabledsstr or dicttPASSLIB_GET_CATEGORYRzNR�s
tget_category(tdjango.confR�tobjectRR+RtDeprecationWarningRdRtbytesRrRtExpectedTypeErrorRzR@R�t__dict__tpoptstrRR|R,R�R5(R2R�t_UNSETtconfigR�((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR��s6
				N( RoRpRqR+R,R�RvRQRkR�R@ROR*R5RWRHR�RuR�R�R�R|tHASHERS_PATHtMODELS_PATHtUSER_CLASS_PATHt
FORMS_PATHRrR�R�R�R�R�(((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyRs�sH!				*		
	
	







	*	'	s--!!!generate-new-salt!!!--t
ProxyPropertycBs2eZdZd�Zd�Zd�Zd�ZRS(s%helper that proxies another attributecCs
||_dS(N(R(R2R((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR*<scCs%|dkr|}nt||j�S(N(R+RR(R2tobjtcls((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt__get__?s	cCst||j|�dS(N(tsetattrR(R2R�R�((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt__set__DscCst||j�dS(N(tdelattrR(R2R�((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt
__delete__Gs(RoRpRqR*R�R�R�(((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR�9s
			RBcBs�eZdZdZd�Zd�Zed��Zed��Zed��Z	ed��Z
d�Zd�Zdddd	�Z
d
�Zd�ZRS(
s�
    adapter which which wraps a :cls:`passlib.ifc.PasswordHash` class,
    and provides an interface compatible with the Django hasher API.

    :param passlib_handler:
        passlib hash handler (e.g. :cls:`passlib.hash.sha256_crypt`.
    cCs~t|dd�r+td|jf��n|jrJtd|j��n||_|jrz|j|_t	d�|_
ndS(NR>sHhandlers that reflect an official django hasher shouldn't be wrapped: %rs%can't wrap disabled-hash handlers: %rtrounds(RR+RRtis_disabledRet_has_roundstdefault_roundsR�R�t
iterations(R2Re((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR*bs			cCsd|jS(Ns!<PasslibHasherWrapper handler=%r>(Re(R2((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt__repr__vscCsd|jjj�S(NsPasslib_%s_PasswordHasher(ReRttitle(R2((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyRo}scCsd|jjkS(NR�(ReR�(R2((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR��scCs;tdd�}|jr7d|jjkr7d|d<n|S(sy
        internal helper for safe_summary() --
        used to translate passlib hash options -> django keywords
        tchecksumR�tpbkdf2R�R�(RrR�ReR(R2tout((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt_translate_kwds�s
cCst|jjS(N(RfReR(R2((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR;�scCstS(N(t_GEN_SALT_SIGNAL(R2((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR��scCs|jj||�S(N(ReR�(R2R�R�((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR��scCs�i}|dk	r+|tkr+||d<n|jrv|dk	rM||d<q�|dk	rf||d<q�|j|d<n,|dk	s�|dk	r�td|j�n|j}|r�|j|�}n|j|�S(NR�R�s0%s.hash(): 'rounds' and 'iterations' are ignored(	R+R�R�R�RRoReR�R�(R2R�R�R�R�R$R7((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytencode�s
	

	c	Cs�ddlm}ddlm}|j}|d�|jfg}t|d�r�|j|d|�}xKt|�D]:\}}|j	j
||�}|j||�|f�qrWnt|�S(Ni����(t	mask_hash(t
ugettext_noopR;t	parsehashtsanitize(
RPR�tdjango.utils.translationR�ReRR?R�R	R�RMtappendR
(	R2R�R�t_R7titemsR$tkeyR�((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytsafe_summary�s	 cCsD|jr@|jjd|jd|j�}|j|�r@tSntS(Nt
min_roundst
max_rounds(R�ReR�R�R�RkR@(R2R�tsubcls((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytmust_update�s
	!N(RoRpRqR+ReR*R�RR�R�R;R�R�R�R�R�(((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyRBKs
					R~cBs�eZdZdd�Zd�ZeZZd�Ze	d��Z
ed�Zdd�Z
dd�Zed�Zd	�Zed
�Zed��Zdeed�Zed
�Zd�ZRS(s4helper to manage monkeypatches and run sanity checkscCs)|ptjtd�|_i|_dS(Ns._PatchManager(RxRyRoRwt_state(R2Rw((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR*7scCs
t|j�S(N(tboolR�(R2((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR�=scCst|jd�\}}t|d|gdd�}x7d|kri|jdd�\}}t||�}q3W||fS(s8retrieve obj and final attribute name from resource pathR�tfromlisttleveliRIi(tsplitt
__import__R(R2RYRRR�thead((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt_import_pathDscCst|�t|�kS(sAcheck if two values are the same (stripping method wrappers, etc)(R(tlefttright((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt_is_same_valueMscCs%|j|�\}}t|||�S(N(R�R(R2R�R\R�R((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt	_get_pathUscCs|j||�S(sreturn current value for path(R�(R2RYR\((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyRMYscCsNy|j|\}}Wn tk
r9|j|�}nX|tkrJ|S|S(s*return original (unpatched) value for path(R�RR�R�(R2RYR\R�R�((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyRR]s

cCs}|j}xmt|j�D]\\}\}}||j|�|�rIqnd|}|rht|��qt|t�qWdS(s:run sanity check on all keys, issue warning if out of syncs(another library has patched resource: %rN(R�R	R�R�R�RR(R2tstricttsameRYtorigtexpectedtmsg((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt	check_alles	"
cCsW|j|�\}}|tkrCt||�rSt||�qSnt|||�dS(N(R�R�R?R�R�(R2RYR�R�R((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt	_set_pathts
cs/|tkst�|j|�}y|j|\}}Wn*tk
rd|jjd|�|}n:X|jjd|�|j||�s�td|t	�n|r�t
|�s�t�|�|���fd�}t||�|}nt
|�r|t|�_
n|j||�||f|j|<dS(sBmonkeypatch object+attr at <path> to have <value>, stores originalspatching resource: %rsmodifying resource: %rs4overridding resource another library has patched: %rcs��||�S(N((R#R$(twrappedt
wrapped_by(s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR&�sN(R�R{R�R�RRwR�R�RRRzRRt_patched_original_valueR(R2RYR�twraptcurrentRRR&((RRs</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR�|s,


	cCs|jS(N(R(R�R�((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR�scsE�����fd�}t��rA�}d�||�dS|S(sBfunction decorator which patches function of same name in <parent>csR�rNd�krdnd}�|�p1|j}�j||d��n|S(NR�RIR	(RoR�(tfunctsepRY(tenableRtparentR2R	(s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytbuilder�s
N(RzR+(R2RRR
R	RR((R
RRR2R	s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytmonkeypatch�s
cCs�y|j|\}}Wntk
r+dSX|j|�}|jjd|�|j||�s�|rztd|t�q�td|t�|j|=dSn|j||�|j|=dS(Nsunpatching resource: %rs2reverting resource another library has patched: %rs6not reverting resource another library has patched: %r(	R�RR�RwR�R�RRR(R2RYR�RRR
((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pytunpatch�s 

cKs.x't|j�D]}|j||�qWdS(N(tlistR�R(R2R$R�((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR��sN(RoRpRqR+R*R�t__bool__t__nonzero__R�tstaticmethodR�R�R�RMRRR@RRR�tclassmethodRRkRRR�(((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyR~-s 		
				(1Rqt	functoolsRRRxRyRoRwRKR-twarningsRtdjangoRR
R�tImportErrorRRRtpasslib.contextRtpasslib.excRtpasslib.utils.compatRR	R
Rtpasslib.utils.decorRt__all__RRRRRfR`tsetRaR'R�R(RsR�R�RBR�R~(((s</usr/lib/python2.7/site-packages/passlib/ext/django/utils.pyt<module>sT


"	
	=	
�
���