<s> from __future__ import absolute_import <EOL> from django . conf import settings <EOL> from horizon import conf <EOL> from . . models import Page <EOL> class WebMiddleware ( object ) : <EOL> """<STR_LIT>""" <EOL> def process_response ( self , request , response ) : <EOL> if hasattr ( request , '<STR_LIT:user>' ) and not request . user . is_authenticated ( ) : <EOL> response . delete_cookie ( '<STR_LIT>' ) <EOL> request . frontend_editing = False <EOL> return response <EOL> def process_request ( self , request ) : <EOL> try : <EOL> leonardo_options = { <EOL> '<STR_LIT>' : settings . META_DESCRIPTION , <EOL> '<STR_LIT>' : settings . META_KEYWORDS , <EOL> '<STR_LIT>' : settings . META_TITLE , <EOL> } <EOL> except : <EOL> leonardo_options = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> leonardo_options [ '<STR_LIT>' ] = { <EOL> '<STR_LIT:name>' : settings . SITE_NAME , <EOL> '<STR_LIT:id>' : settings . SITE_ID , <EOL> '<STR_LIT>' : getattr ( <EOL> settings , '<STR_LIT>' , settings . SITE_NAME + '<STR_LIT>' ) , <EOL> } <EOL> try : <EOL> page = Page . objects . best_match_for_path ( <EOL> request . path ) <EOL> except Exception : <EOL> page = None <EOL> leonardo_options [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> leonardo_options [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> leonardo_options [ '<STR_LIT>' ] = [ ] <EOL> leonardo_options [ '<STR_LIT>' ] = [ ] <EOL> request . leonardo_options = leonardo_options <EOL> request . leonardo_page = page <EOL> request . frontend_editing = request . COOKIES . get ( <EOL> '<STR_LIT>' , False ) <EOL> request . LEONARDO_CONFIG = conf . HORIZON_CONFIG <EOL> request . webcms_page = page <EOL> request . webcms_options = leonardo_options <EOL> request . META [ "<STR_LIT>" ] = True </s>
