本文整理汇总了Python中aspen.website.Website.version方法的典型用法代码示例。如果您正苦于以下问题:Python Website.version方法的具体用法?Python Website.version怎么用?Python Website.version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aspen.website.Website
的用法示例。
在下文中一共展示了Website.version方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_version
# 需要导入模块: from aspen.website import Website [as 别名]
# 或者: from aspen.website.Website import version [as 别名]
'len': len,
'map': map,
'range': range,
'str': str,
'to_javascript': utils.to_javascript,
'type': type,
'unicode': unicode,
}
# Wireup Algorithm
# ================
exc = None
try:
website.version = get_version()
except Exception, e:
exc = e
website.version = 'x'
env = website.env = gratipay.wireup.env()
tell_sentry = website.tell_sentry = gratipay.wireup.make_sentry_teller(env)
website.db = gratipay.wireup.db(env)
website.mailer = gratipay.wireup.mail(env, website.project_root)
gratipay.wireup.base_url(website, env)
gratipay.wireup.secure_cookies(env)
gratipay.wireup.billing(env)
gratipay.wireup.team_review(env)
gratipay.wireup.username_restrictions(website)
gratipay.wireup.load_i18n(website.project_root, tell_sentry)
示例2: add_nav_next_to_context
# 需要导入模块: from aspen.website import Website [as 别名]
# 或者: from aspen.website.Website import version [as 别名]
def add_nav_next_to_context(nav_current, website):
return {'nav_next': nav_current.next_child}
def only_allow_certain_methods(request):
whitelisted = ['GET', 'HEAD', 'POST']
if request.method.upper() not in whitelisted:
raise Response(405)
website.algorithm.insert_before('dispatch_request_to_filesystem', only_allow_certain_methods)
website.algorithm.insert_after('dispatch_request_to_filesystem', add_nav_to_website)
website.algorithm.insert_after('add_nav_to_website', add_nav_current_to_context)
website.algorithm.insert_after('add_nav_current_to_context', add_nav_next_to_context)
# Set website.version.
# ====================
# Yeesh, what a hack. At Heroku we don't have a git repo once deployed, so
# instead of using a git SHA we're going to just use a random string. Doing
# this "right" would mean storing the real version SHA somewhere during
# deployment.
website.version = ''.join([random.choice(string.letters) for i in range(32)])
# Set random thing that we're not really using.
# =============================================
website.compress_assets = False # If set to True, the responsiveness on the lower
# homepage breaks. :-/