def get(self): count = 15 p = self.request.get('p',1) values = myvalues(self.request) xmppemail = '*****@*****.**' sender = db.IM("xmpp", xmppemail) dictkey = xmppemail + '$dict' data = memcache.get(dictkey) if not data: query = MBook.all() query.filter('im =', sender).order('-date') data = [] for item in query: data.append(dict( key = item.key(), word = item.word, pron = item.pron, define = item.define, rating = item.rating, date = item.date, )) memcache.set(dictkey, data, 86400) values['data'] = pagi(data, count, p) tp = os.path.join(DIR, 'admindict.html') self.response.out.write(template.render(tp,values))
def get(self): count = 15 p = self.request.get('p',1) values = myvalues(self.request) xmppemail = values['user'].email().lower() sender = db.IM("xmpp", xmppemail) dictkey = xmppemail + '$dict' action = self.request.get('action') key = self.request.get('key') if key and 'delete' == action: memcache.delete(dictkey) m = db.get(key) if m and m.im == sender: db.delete(m) self.redirect('/user/') if 'refresh' == action: memcache.delete(dictkey) self.redirect('/user/') data = memcache.get(dictkey) if not data: query = MBook.all() query.filter('im =', sender).order('-date') data = [] for item in query: data.append(dict( key = item.key(), word = item.word, pron = item.pron, define = item.define, rating = item.rating, date = item.date, )) memcache.set(dictkey, data, 86400) values['data'] = pagi(data, count, p) tp = os.path.join(DIR, 'user.html') self.response.out.write(template.render(tp,values))