<s> from django . conf import settings <EOL> from django . contrib . auth . models import AnonymousUser <EOL> from django . utils . translation import ( <EOL> ugettext as _ , get_language , get_language_bidi ) <EOL> from django . utils . http import urlquote <EOL> from olympia import amo <EOL> from olympia . amo . urlresolvers import reverse <EOL> from olympia . access import acl <EOL> from olympia . zadmin . models import get_config <EOL> def app ( request ) : <EOL> return { '<STR_LIT>' : getattr ( request , '<STR_LIT>' , None ) } <EOL> def static_url ( request ) : <EOL> return { '<STR_LIT>' : settings . STATIC_URL } <EOL> def i18n ( request ) : <EOL> lang = get_language ( ) <EOL> return { '<STR_LIT>' : settings . LANGUAGES , <EOL> '<STR_LIT>' : settings . LANGUAGE_URL_MAP . get ( lang ) or lang , <EOL> '<STR_LIT>' : '<STR_LIT>' if get_language_bidi ( ) else '<STR_LIT>' } <EOL> def global_settings ( request ) : <EOL> """<STR_LIT>""" <EOL> account_links = [ ] <EOL> tools_links = [ ] <EOL> context = { } <EOL> tools_title = _ ( '<STR_LIT>' ) <EOL> is_reviewer = False <EOL> if request . user . is_authenticated ( ) : <EOL> user = request . user <EOL> profile = request . user <EOL> is_reviewer = ( acl . check_addons_reviewer ( request ) or <EOL> acl . check_personas_reviewer ( request ) ) <EOL> account_links . append ( { '<STR_LIT:text>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : profile . get_url_path ( ) } ) <EOL> if user . is_artist : <EOL> account_links . append ( { '<STR_LIT:text>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : profile . get_user_url ( '<STR_LIT>' ) } ) <EOL> account_links . append ( { '<STR_LIT:text>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : reverse ( '<STR_LIT>' ) } ) <EOL> account_links . append ( { <EOL> '<STR_LIT:text>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : reverse ( '<STR_LIT>' , args = [ user . username ] ) } ) <EOL> if user . favorite_addons : <EOL> account_links . append ( <EOL> { '<STR_LIT:text>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : reverse ( '<STR_LIT>' , <EOL> args = [ user . username , '<STR_LIT>' ] ) } ) <EOL> account_links . append ( { <EOL> '<STR_LIT:text>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : reverse ( '<STR_LIT>' ) + '<STR_LIT>' + urlquote ( request . path ) , <EOL> } ) <EOL> if request . user . is_developer : <EOL> tools_links . append ( { '<STR_LIT:text>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : reverse ( '<STR_LIT>' ) } ) <EOL> links = [ <EOL> { '<STR_LIT:text>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : reverse ( '<STR_LIT>' ) } , <EOL> { '<STR_LIT:text>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : reverse ( '<STR_LIT>' ) } , <EOL> { '<STR_LIT:text>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : reverse ( '<STR_LIT>' ) } , <EOL> ] <EOL> links . append ( { '<STR_LIT:text>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : reverse ( '<STR_LIT>' ) } ) <EOL> tools_links += links <EOL> if is_reviewer : <EOL> tools_links . append ( { '<STR_LIT:text>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : reverse ( '<STR_LIT>' ) } ) <EOL> if ( acl . action_allowed ( request , '<STR_LIT>' , '<STR_LIT:%>' ) or <EOL> acl . action_allowed ( request , '<STR_LIT>' , '<STR_LIT>' ) ) : <EOL> tools_links . append ( { '<STR_LIT:text>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : reverse ( '<STR_LIT>' ) } ) <EOL> context [ '<STR_LIT:user>' ] = request . user <EOL> else : <EOL> context [ '<STR_LIT:user>' ] = AnonymousUser ( ) <EOL> context . update ( { '<STR_LIT>' : account_links , <EOL> '<STR_LIT>' : settings , '<STR_LIT>' : amo , <EOL> '<STR_LIT>' : tools_links , <EOL> '<STR_LIT>' : tools_title , <EOL> '<STR_LIT>' : get_config ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : is_reviewer } ) <EOL> return context </s>
