本文整理汇总了Python中models.Account.get_by_hash方法的典型用法代码示例。如果您正苦于以下问题:Python Account.get_by_hash方法的具体用法?Python Account.get_by_hash怎么用?Python Account.get_by_hash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Account
的用法示例。
在下文中一共展示了Account.get_by_hash方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import get_by_hash [as 别名]
def get(self):
outlets = Outlet.all().filter('target =', self.account).fetch(100)
if len(self.request.path.split('/')) > 2:
source = Account.get_by_hash(self.request.path.split('/')[-1])
channel = Channel.get_by_source_and_target(source, self.account)
self.render('templates/source.html', locals())
else:
enabled_channels = Channel.get_all_by_target(self.account).order('-count').filter('status =', 'enabled')
self.render('templates/sources.html', locals())
示例2: get
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import get_by_hash [as 别名]
def get(self):
outlets = Outlet.all().filter("target =", self.account).fetch(100)
if len(self.request.path.split("/")) > 2:
source = Account.get_by_hash(self.request.path.split("/")[-1])
channel = Channel.get_by_source_and_target(source, self.account)
self.render("templates/source.html", locals())
else:
enabled_channels = Channel.get_all_by_target(self.account).order("-count").filter("status =", "enabled")
# TODO: remove me after a while. this is to fix my poor reference management
for c in enabled_channels:
try:
c.outlet
except:
c.outlet = None
c.put()
self.render("templates/sources.html", locals())
示例3: post
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import get_by_hash [as 别名]
def post(self):
action = self.request.get("action")
source = Account.get_by_hash(self.request.get("source"))
channel = Channel.get_by_source_and_target(source, self.account)
if action == "approve":
channel.status = "enabled"
channel.put()
elif action == "delete":
channel.delete()
elif action == "route":
outlet = Outlet.get_by_hash(self.request.get("outlet"))
channel.outlet = outlet
channel.put()
if "return" in self.request.query_string:
self.redirect("/sources/%s" % self.request.get("source"))
else:
self.redirect("/sources")
示例4: post
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import get_by_hash [as 别名]
def post(self):
action = self.request.get('action')
source = Account.get_by_hash(self.request.get('source'))
channel = Channel.get_by_source_and_target(source, self.account)
if action == 'approve':
channel.status = 'enabled'
channel.put()
elif action == 'delete':
channel.delete()
elif action == 'route':
outlet = Outlet.get_by_hash(self.request.get('outlet'))
channel.outlet = outlet
channel.put()
if 'return' in self.request.query_string:
self.redirect('/sources/%s' % self.request.get('source'))
else:
self.redirect('/sources')