def post(self): user_logado = users.get_current_user() date = datetime.now() - timedelta(hours=timezone) if not RegistraCafe.getJaFez() and\ (date.hour >= 9 and date.hour < 18) and\ (date.weekday() != 5 and date.weekday() != 6) or DEBUG == True: fez = RegistraCafe(user=user_logado, date_creation=date) fez.save() memcache.delete('context_home') todos_usuarios = RegistraCafe.getQuantidadeCafe() for item in todos_usuarios: user = item.get('user_email', '') self.sendMail(user, date, user_logado.email()) self.redirect('/')
def post(self): user_logado = users.get_current_user() date = datetime.now() - timedelta(hours=timezone) if not RegistraCafe.getJaFez() and\ (date.hour >= 9 and date.hour < 18) and\ (date.weekday() != 5 and date.weekday() != 6) or DEBUG == True: fez = RegistraCafe(user = user_logado, date_creation = date) fez.save() memcache.delete('context_home') todos_usuarios = RegistraCafe.getQuantidadeCafe() for item in todos_usuarios: user = item.get('user_email','') self.sendMail(user, date, user_logado.email()) self.redirect('/')
def get(self): context = memcache.get('context_home') if not context: context = {} context['fezcafe'] = RegistraCafe.getJaFez() L = [] for item in RegistraCafe.getAll().fetch(5): L.append({'username': item.userName, 'dateTimeText': item.dateTimeText}) context['dados'] = L context['quantidade'] = RegistraCafe.getQuantidadeCafe() memcache.add('context_home',context, 21600) context['user'] = users.get_current_user() doRender(self,'homepage.pt',context)
def get(self): context = memcache.get('context_home') if not context: context = {} context['fezcafe'] = RegistraCafe.getJaFez() L = [] for item in RegistraCafe.getAll().fetch(5): L.append({ 'username': item.userName, 'dateTimeText': item.dateTimeText }) context['dados'] = L context['quantidade'] = RegistraCafe.getQuantidadeCafe() memcache.add('context_home', context, 21600) context['user'] = users.get_current_user() doRender(self, 'homepage.pt', context)