當前位置: 首頁>>代碼示例>>Python>>正文


Python Config.put方法代碼示例

本文整理匯總了Python中models.Config.put方法的典型用法代碼示例。如果您正苦於以下問題:Python Config.put方法的具體用法?Python Config.put怎麽用?Python Config.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.Config的用法示例。


在下文中一共展示了Config.put方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: is_open_or_close

# 需要導入模塊: from models import Config [as 別名]
# 或者: from models.Config import put [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
開發者ID:esseti,項目名稱:fantacalcio-mercato-libero,代碼行數:10,代碼來源:main.py

示例2: set_auth_secret

# 需要導入模塊: from models import Config [as 別名]
# 或者: from models.Config import put [as 別名]
def set_auth_secret(secret):
    """
    Sets the auth secret.
    """
    from models import Config
    secret_config = Config()
    secret_config.key = "auth_secret"
    secret_config.value = secret
    secret_config.put()
    return secret_config
開發者ID:dothiv,項目名稱:clickcounter-backend,代碼行數:12,代碼來源:settings.py

示例3: save_config

# 需要導入模塊: from models import Config [as 別名]
# 或者: from models.Config import put [as 別名]
def save_config():
    try:
        data = json.loads(request.data)
        name = data['name']
        value = data['value']
        config = Config(
            name=name,
            value=value
        )
        config.put()
    except CapabilityDisabledError:
        logging.error(u'App Engine Datastore is currently in read-only mode.')
        abort(500)
    except BadValueError:
        abort(400)
    except TypeError:
        abort(400)
    except Exception as e:
        logging.error(e.args[0])
        abort(500)

    return Response(json.dumps(config.to_dict()), mimetype='application/json');
開發者ID:jmangi13,項目名稱:yakin-tracker,代碼行數:24,代碼來源:views.py

示例4: sendMailResult

# 需要導入模塊: from models import Config [as 別名]
# 或者: from models.Config import put [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()
開發者ID:esseti,項目名稱:fantacalcio-mercato-libero,代碼行數:26,代碼來源:cron.py

示例5: get

# 需要導入模塊: from models import Config [as 別名]
# 或者: from models.Config import put [as 別名]
 def get(self):
     status = Config.query().get()
     if not status:
         status = Config()
     status.is_open = False
     status.put()
開發者ID:esseti,項目名稱:fantacalcio-mercato-libero,代碼行數:8,代碼來源:cron.py

示例6: set_open_or_closed

# 需要導入模塊: from models import Config [as 別名]
# 或者: from models.Config import put [as 別名]
def set_open_or_closed(v):
    c = Config.query().get()
    if not c:
        c = Config()
    c.is_open = v
    c.put()
開發者ID:esseti,項目名稱:fantacalcio-mercato-libero,代碼行數:8,代碼來源:cron.py

示例7: Storage

# 需要導入模塊: from models import Config [as 別名]
# 或者: from models.Config import put [as 別名]
import os
import logging
from models import Config
from utils import Storage

__all__ = [ 'config', 'settings', ]

logging.info('module config reloaded')

settings = Storage()

config = Config.get_by_key_name('default')

if not config:
	config = Config(key_name = 'default')
	config.put()

if not config.app_root:
	settings.app_root = ''
else:
	settings.app_root = '/' + config.app_root.strip('/ ')

settings.home_page = settings.app_root + '/'

開發者ID:jfojfo,項目名稱:foblog,代碼行數:25,代碼來源:config.py


注:本文中的models.Config.put方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。