<s> """<STR_LIT>""" <EOL> from django . conf import settings <EOL> from django . middleware . csrf import get_token <EOL> from django . utils . functional import lazy <EOL> def auth ( request ) : <EOL> """<STR_LIT>""" <EOL> import warnings <EOL> warnings . warn ( <EOL> "<STR_LIT>" "<STR_LIT>" "<STR_LIT>" , <EOL> PendingDeprecationWarning <EOL> ) <EOL> from django . contrib . auth . context_processors import auth as auth_context_processor <EOL> return auth_context_processor ( request ) <EOL> def csrf ( request ) : <EOL> """<STR_LIT>""" <EOL> def _get_val ( ) : <EOL> token = get_token ( request ) <EOL> if token is None : <EOL> return '<STR_LIT>' <EOL> else : <EOL> return token <EOL> _get_val = lazy ( _get_val , str ) <EOL> return { '<STR_LIT>' : _get_val ( ) } <EOL> def debug ( request ) : <EOL> "<STR_LIT>" <EOL> context_extras = { } <EOL> if settings . DEBUG and request . META . get ( '<STR_LIT>' ) in settings . INTERNAL_IPS : <EOL> context_extras [ '<STR_LIT>' ] = True <EOL> from django . db import connection <EOL> context_extras [ '<STR_LIT>' ] = connection . queries <EOL> return context_extras <EOL> def i18n ( request ) : <EOL> from django . utils import translation <EOL> context_extras = { } <EOL> context_extras [ '<STR_LIT>' ] = settings . LANGUAGES <EOL> context_extras [ '<STR_LIT>' ] = translation . get_language ( ) <EOL> context_extras [ '<STR_LIT>' ] = translation . get_language_bidi ( ) <EOL> return context_extras <EOL> def media ( request ) : <EOL> """<STR_LIT>""" <EOL> return { '<STR_LIT>' : settings . MEDIA_URL } <EOL> def request ( request ) : <EOL> return { '<STR_LIT>' : request } <EOL> class PermLookupDict ( object ) : <EOL> def __init__ ( self , user , module_name ) : <EOL> self . user , self . module_name = user , module_name <EOL> def __repr__ ( self ) : <EOL> return str ( self . user . get_all_permissions ( ) ) <EOL> def __getitem__ ( self , perm_name ) : <EOL> return self . user . has_perm ( "<STR_LIT>" % ( self . module_name , perm_name ) ) <EOL> def __nonzero__ ( self ) : <EOL> return self . user . has_module_perms ( self . module_name ) <EOL> class PermWrapper ( object ) : <EOL> def __init__ ( self , user ) : <EOL> self . user = user <EOL> def __getitem__ ( self , module_name ) : <EOL> return PermLookupDict ( self . user , module_name ) <EOL> def __iter__ ( self ) : <EOL> raise TypeError ( "<STR_LIT>" ) </s>
