def post(self, brand_requested, action): global brand analyticsProps = configparsers.loadPropertyFile('analytics') gaAccount = analyticsProps.get('GA', 'ga_account') if brand_requested is not None and brand_requested != '': user = self.request.POST.get('session') if utils.validate_brand(brand_requested): viewState = 'start' brand = brand_requested section_content = utils.create_section_content(brand) session_key = None app_version = os.environ['CURRENT_VERSION_ID'] brandProps = configparsers.loadPropertyFile('brand') brandDisplayName = brandProps.get(brand, 'display_name') self.context['sessionKey']=session_key self.context['sections']=section_content self.context['viewState']=viewState self.context['brand']=brand self.context['user']=user self.context['brandDisplayName']=brandDisplayName self.context['ga_account']=gaAccount template = 'index' self.render(template) else: self.error(500) else: self.error(500)
def get(self, brand_requested, user_id_requested): global brand analyticsProps = configparsers.loadPropertyFile('analytics') gaAccount = analyticsProps.get('GA', 'ga_account') brandProps = configparsers.loadPropertyFile('brand') home_content = utils.get_home_content(brandProps) if brand_requested is not None and brand_requested != '' and user_id_requested is not None and user_id_requested != '' and brandProps.has_section(brand_requested): brand = brand_requested brandDisplayName = brandProps.get(brand, 'display_name') section_content = utils.create_section_content(brand) session_key = None if utils.validate_client_user(brand_requested, user_id_requested) and utils.validate_brand(brand_requested): viewState = 'new' self.context['home_content']=home_content self.context['sessionKey']=session_key self.context['sections']=section_content self.context['viewState']=viewState self.context['brand']=brand self.context['user']=user_id_requested self.context['brandDisplayName']=brandDisplayName self.context['ga_account']=gaAccount template = 'index' self.render(template) else: logging.warning('No valid Brand or User found') viewState = 'error-404' self.context['viewState']=viewState self.context['brand']=brand self.context['user']=user_id_requested self.context['brandDisplayName']=brandDisplayName self.context['ga_account']=gaAccount template = 'error' self.response.set_status(404) self.render(template) else: viewState = 'error-404' self.context['viewState']=viewState self.context['brand']='razorfish' self.context['brandDisplayName']='Razorfish' self.context['ga_account']=gaAccount template = 'error' self.response.set_status(404) self.render(template)
def get(self, brand_requested): analyticsProps = configparsers.loadPropertyFile('analytics') gaAccount = analyticsProps.get('GA', 'ga_account') global brand if brand_requested is not None and brand_requested != '': if '/' in brand_requested: requestSplit = brand_requested.split('/') brand_requested = requestSplit[0] else: brand_requested = brand_requested if utils.validate_brand(brand_requested): brand = brand_requested brandProps = configparsers.loadPropertyFile('brand') brandDisplayName = brandProps.get(brand, 'display_name') self.context['brandDisplayName']=brandDisplayName self.context['brand']=brand self.context['ga_account']=gaAccount template = 'success' self.render(template)