本文整理匯總了Python中models.Config.is_open方法的典型用法代碼示例。如果您正苦於以下問題:Python Config.is_open方法的具體用法?Python Config.is_open怎麽用?Python Config.is_open使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.Config
的用法示例。
在下文中一共展示了Config.is_open方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: is_open_or_close
# 需要導入模塊: from models import Config [as 別名]
# 或者: from models.Config import is_open [as 別名]
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
示例2: sendMailResult
# 需要導入模塊: from models import Config [as 別名]
# 或者: from models.Config import is_open [as 別名]
def sendMailResult():
# TODO: test this
message = mail.EmailMessage(sender="MercatoLibero <[email protected]>",
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()
示例3: get
# 需要導入模塊: from models import Config [as 別名]
# 或者: from models.Config import is_open [as 別名]
def get(self):
status = Config.query().get()
if not status:
status = Config()
status.is_open = False
status.put()
示例4: set_open_or_closed
# 需要導入模塊: from models import Config [as 別名]
# 或者: from models.Config import is_open [as 別名]
def set_open_or_closed(v):
c = Config.query().get()
if not c:
c = Config()
c.is_open = v
c.put()