本文整理匯總了Python中ziggurat_foundations.models.services.user.UserService.by_id方法的典型用法代碼示例。如果您正苦於以下問題:Python UserService.by_id方法的具體用法?Python UserService.by_id怎麽用?Python UserService.by_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ziggurat_foundations.models.services.user.UserService
的用法示例。
在下文中一共展示了UserService.by_id方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_user
# 需要導入模塊: from ziggurat_foundations.models.services.user import UserService [as 別名]
# 或者: from ziggurat_foundations.models.services.user.UserService import by_id [as 別名]
def get_user(request):
userid = request.unauthenticated_userid
if try_global_session:
# set db_session to none to pass to the UserModel.by_id so it can try to autodiscover
db_session = None
else:
# Else assign the request.session
db_session = session_provider_callable(request)
if userid is not None:
return UserService.by_id(userid, db_session=db_session)
示例2: by_id
# 需要導入模塊: from ziggurat_foundations.models.services.user import UserService [as 別名]
# 或者: from ziggurat_foundations.models.services.user.UserService import by_id [as 別名]
def by_id(cls, user_id, db_session=None):
"""
.. deprecated:: 0.8
:param user_id:
:param db_session:
:return:
"""
db_session = get_db_session(db_session)
return UserService.by_id(user_id=user_id, db_session=db_session)