def post(self): login_user = get_login_user() template_values = get_current_user_template_values(login_user,self.request.uri) format = self.request.get("json", None) if not format: format = 'yaml' else: format = 'JSON' # not logged in if not login_user: self.redirect('/login') return if memcache.get('import_status'): # there is already an import going on template_values['errors'] = ["Previous import is still processing. Please be patient..."] path = os.path.join(os.path.dirname(__file__), "take2import_file.html") self.response.out.write(template.render(path, template_values)) return memcache.set('import_status', "Queued import task", time=30) memcache.set('import_data', self.request.get("backup"), time=300) logging.info("") # start background process taskqueue.add(url='/import_task', queue_name="import", params={'login_user': str(login_user.key()), 'format': self.request.get("format", None)}) # redirect to page which will show the import progress self.redirect('/import_status')
def get(self): login_user = get_login_user() template_values = get_current_user_template_values(login_user,self.request.uri) # not logged in if not login_user: self.redirect('/login') return path = os.path.join(os.path.dirname(__file__), "take2import_file.html") self.response.out.write(template.render(path, template_values))
def get(self): login_user = get_login_user() template_values = get_current_user_template_values(login_user,self.request.uri) # not logged in. display login options if not login_user: path = os.path.join(os.path.dirname(__file__), 'take2login.html') self.response.out.write(template.render(path, template_values)) return if not login_user.me: self.redirect('/welcome') return self.redirect('/') return
def get(self): """processes the signup form""" authenticated_user = users.get_current_user() login_user = get_login_user() template_values = get_current_user_template_values(login_user,self.request.uri) # not logged in if not authenticated_user: self.redirect('/login') return # already connected if login_user and login_user.me: self.redirect('/') return template_values['errors'] = [] person = PersonBean.edit(None,self.request) template_values.update(person.get_template_values()) err = person.validate() terms=self.request.get("terms", None) if not terms: err.append("You must also acknowledge the terms and conditions.") if not err: try: db.run_in_transaction(initial_user_setup, authenticated_user, person) except: # an error occured in storing the data logging.exception('Transaction failed while storing LoginUser and Person') template_values['errors'].append('Database error. Sorry.') else: template_values['errors'].extend(err) if len(template_values['errors']): path = os.path.join(os.path.dirname(__file__), "take2welcome.html") self.response.out.write(template.render(path, template_values)) return # create search index which is usually done by the PersonBean but not here # because the index table is not in the entity group update_index(person.entity) self.redirect('/')
def get(self): """processes the signup form""" authenticated_user = users.get_current_user() login_user = get_login_user() template_values = get_current_user_template_values(login_user,self.request.uri) # not logged in if not authenticated_user: self.redirect('/login') return # already connected if login_user and login_user.me: self.redirect('/') return # prepare list of days and months template_values.update(prepare_birthday_selectors()) path = os.path.join(os.path.dirname(__file__), 'take2welcome.html') self.response.out.write(template.render(path, template_values)) return
def get(self): login_user = get_login_user() template_values = get_current_user_template_values(login_user,self.request.uri) path = os.path.join(os.path.dirname(__file__), 'take2map.html') self.response.out.write(template.render(path, template_values))