<s> """<STR_LIT>""" <EOL> from django . conf import settings <EOL> def auth ( request ) : <EOL> """<STR_LIT>""" <EOL> return { <EOL> '<STR_LIT:user>' : request . user , <EOL> '<STR_LIT>' : request . user . get_and_delete_messages ( ) , <EOL> '<STR_LIT>' : PermWrapper ( request . user ) , <EOL> } <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> context_extras = { } <EOL> context_extras [ '<STR_LIT>' ] = settings . LANGUAGES <EOL> if hasattr ( request , '<STR_LIT>' ) : <EOL> context_extras [ '<STR_LIT>' ] = request . LANGUAGE_CODE <EOL> else : <EOL> context_extras [ '<STR_LIT>' ] = settings . LANGUAGE_CODE <EOL> from django . utils import translation <EOL> context_extras [ '<STR_LIT>' ] = translation . get_language_bidi ( ) <EOL> return context_extras <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 ) </s>
