本文整理汇总了Python中user.User.by_id方法的典型用法代码示例。如果您正苦于以下问题:Python User.by_id方法的具体用法?Python User.by_id怎么用?Python User.by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.User
的用法示例。
在下文中一共展示了User.by_id方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getUserName
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import by_id [as 别名]
def getUserName(self):
"""
Gets username of the person, who wrote the blog post.
"""
user = User.by_id(self.user_id)
return user.name
示例2: post
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import by_id [as 别名]
def post(self):
from pages.postjson import CatalogManagerAddJson
handler_para = CatalogManagerAddPara(self)
handler_json = CatalogManagerAddJson(self)
usr = self.current_user
book = Catalog.by_id(handler_para['id'])
if book is None:
handler_json.by_status(1)
handler_json.write()
return #book not exist
tomodify = User.by_id(handler_para['uid'])
if tomodify is None:
handler_json.by_status(2)
handler_json.write()
return #user to add not exist
tmp_auth = book.authority_verify(usr=usr)
if test_auth(tmp_auth, A_OWNER) is False:
handler_json.by_status(4)
handler_json.write()
return #permission denied
add_stat = book.add_manager(tomodify)
if add_stat is False:
handler_json.by_status(3)
handler_json.write()
return #managers full
handler_json['new_manager'] = tomodify.json_info_view_by(usr=usr)
handler_json.by_status(0)
handler_json.write()
return #0
示例3: get
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import by_id [as 别名]
def get(self, uid):
handler_page = RSSUserBlogPage(self)
usr = User.by_id(uid)
if usr is not None:
handler_page.update(**usr.blog_rss_info)
handler_page.init_page()
handler_page.render()
return #0
示例4: initialize
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import by_id [as 别名]
def initialize(self, *a, **kw):
"""
This methods gets executed for each page and
verfies user login status, using oookie information.
"""
webapp2.RequestHandler.initialize(self, *a, **kw)
uid = self.read_secure_cookie('user_id')
self.user = uid and User.by_id(int(uid))
示例5: initialize
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import by_id [as 别名]
def initialize(self, *a, **kw):
webapp2.RequestHandler.initialize(self, *a, **kw)
uid = self.read_secure_cookie('user_id')
self.user = uid and User.by_id(int(uid))
if self.request.url.endswith('.json'):
self.format = 'json'
else:
self.format = 'html'
示例6: post
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import by_id [as 别名]
def post(self):
handler_para = UserUnfollowPara(self)
handler_json = UserUnfollowJson(self)
usr = self.current_user
tounfollow = User.by_id(handler_para['uid'])
if tounfollow:
usr.unfollow_user(tounfollow)
handler_json.by_status(0)
handler_json.write()
return #0
示例7: get_init
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import by_id [as 别名]
def get_init(self, uid=None):
from user import User
usr = self.current_user
self.usr= usr
if uid is None:
if usr is None:
self.redirect('/login')
return
self.author = usr
else:
self.author = User.by_id(uid)
if self.author is None:
self.author = User.find_one({'domain':uid})
if self.author is None:
self.send_error(404)
return
示例8: Taringa
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import by_id [as 别名]
class Taringa():
_TARINGA_API_HOST = "api.taringa.net"
def __init__(self):
self.api = API(self._TARINGA_API_HOST)
self.shout = Shout(self.api)
self.user = User(self.api)
self.post = Post(self.api)
def reconnect(self):
self.api.reconnect()
def shout_actions(self, shoutid, trimuser=1, page=1):
return self.shout.actions(shoutid, trimuser, page)
def user_shouts(self, userid, trimuser=1, page=1, count=50):
return self.shout.by_user(userid, trimuser, page, count)
def user_by_id(self, userid):
return self.user.by_id(userid)
def user_by_nick(self, nickname):
return self.user.by_nick(nickname)
def user_following(self, userid, trimuser=1, page=1, count=50):
return self.user.followings(userid, trimuser, page, count)
def user_followers(self, userid, trimuser=1, page=1, count=50):
return self.user.followers(userid, trimuser, page, count)
# Corroborar los parametros completos con la doc de la api, cuando este disponible nuevamente
def post_comments(self, postid, trimuser=1, page=1):
return self.post.comments(postid, trimuser, page)
def post_recents(self, category, trimuser=1, page=1, count=None):
return self.post.recent(category, trimuser, page, count)
#TOPs
def post_populars(self, interval):
return self.post.populars(interval)
示例9: initialize
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import by_id [as 别名]
def initialize(self, *a, **kw):
webapp2.RequestHandler.initialize(self, *a, **kw)
uid = self.read_secure_cookie('user_id')
self.user = uid and User.by_id(int(uid))
示例10: getUserName
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import by_id [as 别名]
def getUserName(self):
user = User.by_id(self.user_id)
return user.name
示例11: getter
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import by_id [as 别名]
def getter(self):
from user import User
return User.by_id(self.data["author_id"])