def get(self): if users.get_current_user().__str__().upper() != 'kisflying'.upper(): return self.redirect(users.create_login_url('/otis/')) key = self.request.get('key') otises = Otis.all().order('Path') #.fetch(39,int(offset)) if key: otis = db.get(db.Key(self.request.get('key'))) template_values = {'otises':otises, 'otis': otis, 'isNew': 0} else: template_values = {'otises':otises, 'isNew': 1} path = os.path.join(os.path.dirname(__file__), 'templates/otis.html') self.response.out.write(template.render(path, template_values))
def post(self): isNew = self.request.get('hiddenIsNew') if isNew == '1': otis = Otis() else: key = self.request.get('key') otis = db.get(db.Key(self.request.get('key'))) otis.Path = self.request.get('textPath') otis.Title = self.request.get('textTitle') otis.Email = self.request.get('textEmail') otis.Account = self.request.get('textAccount') otis.EncodedText = self.request.get('textText') otis.Url = self.request.get('textUrl') otis.Description = self.request.get('textDescription') otis.UpdateDateTime = datetime.datetime.now() otis.put() return self.redirect('/otis/')