本文整理汇总了Python中v2ex.picky.Datum.put方法的典型用法代码示例。如果您正苦于以下问题:Python Datum.put方法的具体用法?Python Datum.put怎么用?Python Datum.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类v2ex.picky.Datum
的用法示例。
在下文中一共展示了Datum.put方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from v2ex.picky import Datum [as 别名]
# 或者: from v2ex.picky.Datum import put [as 别名]
def post(self):
self.session = Session()
if CheckAuth(self) is False:
return DoAuth(self, '/writer/settings')
Datum.set('site_domain', self.request.get('site_domain'))
Datum.set('site_domain_sync', self.request.get('site_domain_sync'))
Datum.set('site_name', self.request.get('site_name'))
Datum.set('site_author', self.request.get('site_author'))
Datum.set('site_slogan', self.request.get('site_slogan'))
Datum.set('site_analytics', self.request.get('site_analytics'))
if self.request.get('site_default_format') not in CONTENT_FORMATS:
Datum.set('site_default_format', 'html')
else:
Datum.set('site_default_format', self.request.get('site_default_format'))
Datum.set('twitter_consumer_key', self.request.get('twitter_consumer_key'))
Datum.set('twitter_consumer_secret', self.request.get('twitter_consumer_secret'))
Datum.set('twitter_access_token_key', self.request.get('twitter_access_token_key'))
Datum.set('twitter_access_token_secret', self.request.get('twitter_access_token_secret'))
q = db.GqlQuery("SELECT * FROM Datum WHERE title = 'twitter_sync'")
if q.count() == 1:
twitter_sync = q[0]
else:
twitter_sync = Datum()
twitter_sync.title = 'twitter_sync'
twitter_sync.substance = self.request.get('twitter_sync')
if twitter_sync.substance == 'True':
twitter_sync.substance = 'True'
else:
twitter_sync.substance = 'False'
twitter_sync.put()
Datum.set('feed_url', self.request.get('feed_url'))
themes = os.listdir(os.path.join(os.path.dirname(__file__), 'tpl', 'themes'))
if self.request.get('site_theme') in themes:
Datum.set('site_theme', self.request.get('site_theme'))
else:
Datum.set('site_theme', 'default')
memcache.delete('mentions_twitter')
self.redirect('/writer/settings')
示例2: post
# 需要导入模块: from v2ex.picky import Datum [as 别名]
# 或者: from v2ex.picky.Datum import put [as 别名]
def post(self):
self.session = Session()
if CheckAuth(self) is False:
return DoAuth(self, "/writer/settings")
Datum.set("site_domain", self.request.get("site_domain"))
Datum.set("site_domain_sync", self.request.get("site_domain_sync"))
Datum.set("site_name", self.request.get("site_name"))
Datum.set("site_author", self.request.get("site_author"))
Datum.set("site_slogan", self.request.get("site_slogan"))
Datum.set("site_analytics", self.request.get("site_analytics"))
if self.request.get("site_default_format") not in CONTENT_FORMATS:
Datum.set("site_default_format", "html")
else:
Datum.set("site_default_format", self.request.get("site_default_format"))
Datum.set("twitter_account", self.request.get("twitter_account"))
Datum.set("twitter_password", self.request.get("twitter_password"))
q = db.GqlQuery("SELECT * FROM Datum WHERE title = 'twitter_sync'")
if q.count() == 1:
twitter_sync = q[0]
else:
twitter_sync = Datum()
twitter_sync.title = "twitter_sync"
twitter_sync.substance = self.request.get("twitter_sync")
if twitter_sync.substance == "True":
twitter_sync.substance = "True"
else:
twitter_sync.substance = "False"
twitter_sync.put()
Datum.set("feed_url", self.request.get("feed_url"))
themes = os.listdir(os.path.join(os.path.dirname(__file__), "tpl", "themes"))
if self.request.get("site_theme") in themes:
Datum.set("site_theme", self.request.get("site_theme"))
else:
Datum.set("site_theme", "default")
memcache.delete("mentions_twitter")
self.redirect("/writer/settings")