def is_open_or_close(): c = Config.query().get() if not c: c = Config() c.is_open = False c.put() return False return c.is_open
def sendMailResult(): # TODO: test this message = mail.EmailMessage(sender="MercatoLibero <*****@*****.**>", subject="Risultati") users = User.query().fetch() to = "" for user in users: to += user.email + ";" message.to = to calls_open = Call.query(Call.status == "OPEN").fetch() status = Config.query().get() if not status: status = Config() status.is_open = True status.put() if len(calls_open) > 0: path = os.path.join(os.path.dirname(__file__), 'templates', 'mail_results.html') params = dict(open=[e.to_dict() for e in calls_open]) res = template.render(path, params) for o in calls_open: o.status = "CLOSED" o.put() message.html = res message.send()
def get(self): status = Config.query().get() if not status: status = Config() status.is_open = False status.put()
def set_open_or_closed(v): c = Config.query().get() if not c: c = Config() c.is_open = v c.put()