本文整理汇总了Python中models.Setting.smarthistory_version方法的典型用法代码示例。如果您正苦于以下问题:Python Setting.smarthistory_version方法的具体用法?Python Setting.smarthistory_version怎么用?Python Setting.smarthistory_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Setting
的用法示例。
在下文中一共展示了Setting.smarthistory_version方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clearCache
# 需要导入模块: from models import Setting [as 别名]
# 或者: from models.Setting import smarthistory_version [as 别名]
def clearCache():
Setting.smarthistory_version(int(Setting.smarthistory_version()) + 1)
示例2: SmartHistoryLoadException
# 需要导入模块: from models import Setting [as 别名]
# 或者: from models.Setting import smarthistory_version [as 别名]
else:
raise SmartHistoryLoadException(response.status_code)
except Exception, e:
raise SmartHistoryLoadException("Post attempt failed to SmartHsitory with :"+str(e))
return
self.response.out.write(data)
@staticmethod
def clearCache():
Setting.smarthistory_version(int(Setting.smarthistory_version()) + 1)
#load the resource from smart history's server and then cache it in the data store
#if it is an image then cache it in the blob store and store the blobkey in the data store
@layer_cache.cache_with_key_fxn(
lambda self: "smart_history_v%s_%s" % (Setting.smarthistory_version(), self.request.path_qs),
layer = layer_cache.Layers.Datastore,
expiration = SMARTHISTORY_CACHE_EXPIRATION_TIME,
persist_across_app_versions = True,
permanent_key_fxn = lambda self: "smart_history_permanent_%s" % (self.request.path_qs))
def load_resource(self):
path = self.request.path
#img is in users browser cache - we don't want to cache a Not-Modified response otherwise people who don't have image in browser cache won't get it
headers = dict((k, v) for (k, v) in self.request.headers.iteritems() if k not in ["If-Modified-Since", "If-None-Match", "Content-Length","Host"])
logging.info("getting resource " + str(path) + " from "+SMARTHISTORY_URL);
try:
response = urlfetch.fetch(url = SMARTHISTORY_URL + path, headers = headers, deadline=25)
except urlfetch.ResponseTooLargeError, e:
logging.info("got too large a file back, sending redirect headers")