def __call__(self, environ, start_response): raw_post_data = environ['wsgi.input'].read( int(environ['CONTENT_LENGTH'])) parsed_post_data = urlparse.parse_qs(raw_post_data) facebook_uid = self.facebook_uid_from_cookie(environ) try: chart = Chart.from_parsed_post_data(self.dbconn, facebook_uid, parsed_post_data) redirect_target = ( '%s/chart/%s' % (self.config_wrapper.parsed_config['server']['host'], chart.chart_id)) start_response('302 FOUND', [('Location', redirect_target)]) return [] except ValueError, ex: start_response('200 OK', [('Content-Type', 'text/html; charset=utf-8')]) message = ex.args[0] t = self.templates.get_template('new-chart-error.html') return [t.render(message=ex.args[0])]
def __call__(self, environ, start_response): raw_post_data = environ['wsgi.input'].read( int(environ['CONTENT_LENGTH'])) parsed_post_data = urlparse.parse_qs(raw_post_data) facebook_uid = self.facebook_uid_from_cookie(environ) try: chart = Chart.from_parsed_post_data( self.dbconn, facebook_uid, parsed_post_data) redirect_target = ( '%s/chart/%s' % (self.config_wrapper.parsed_config['server']['host'], chart.chart_id)) start_response( '302 FOUND', [('Location', redirect_target)]) return [] except ValueError, ex: start_response( '200 OK', [('Content-Type', 'text/html; charset=utf-8')]) message = ex.args[0] t = self.templates.get_template('new-chart-error.html') return [t.render(message=ex.args[0])]