当前位置: 首页>>代码示例>>Python>>正文


Python User.get_by_id方法代码示例

本文整理汇总了Python中user.User.get_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_by_id方法的具体用法?Python User.get_by_id怎么用?Python User.get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在user.User的用法示例。


在下文中一共展示了User.get_by_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: removeUserFollowing

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
def removeUserFollowing(user_id_follower, user_id_following):
    user_follower = User.get_by_id(user_id_follower)
    user_following = User.get_by_id(user_id_following)
    follow_query = Follow.all()
    follow_query.filter("user_follower =", user_follower)
    follow_query.filter("user_following =", user_following)
    db.delete(follow_query.get())
开发者ID:andrefreitas,项目名称:feup-ldso-foodrific,代码行数:9,代码来源:follow.py

示例2: isUserFollowing

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
def isUserFollowing(user_id_follower, user_id_following):
    user_follower = User.get_by_id(user_id_follower)
    user_following = User.get_by_id(user_id_following)
    follow_query = Follow.all()
    follow_query.filter("user_follower =", user_follower)
    follow_query.filter("user_following =", user_following)
    is_follow = follow_query.get()
    if(is_follow is not None):
        return True
    else:
        return False
开发者ID:andrefreitas,项目名称:feup-ldso-foodrific,代码行数:13,代码来源:follow.py

示例3: get_info

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
    def get_info(self, token):
        """
        Returns user's info

        :param token: Token which was returned by login method
        :return dict user_info: Dictionary with users's info's
        """
        user = User.get_by_id(token.userid)
        return {"user_info": {"email": user.email, "display_name": user.display_name}}
开发者ID:frm-system,项目名称:frm,代码行数:11,代码来源:userapi.py

示例4: YummyDone

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
def YummyDone(user_id, post_id):
	user_delete_yummy = User.get_by_id(user_id)
	post_delete_yummy = Post.get_by_id(post_id)
	yummy = Yummy.all()
	yummy.filter("user =", user_delete_yummy)
	yummy.filter("post =", post_delete_yummy)
	if (len(yummy.fetch(1000)) > 0):
		return True
	else:
		return False
开发者ID:andrefreitas,项目名称:feup-ldso-foodrific,代码行数:12,代码来源:yummy.py

示例5: get_by_user

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
 def get_by_user(cls, user_id, keys_only=False):
     '''
     Returns a list of all coupons
     '''
     user = User.get_by_id(user_id)
     coupon_keys = user.held_coupons
     if keys_only:
         return coupon_keys
     else:
         return ndb.get_multi(coupon_keys)
开发者ID:rootlis,项目名称:wolfings,代码行数:12,代码来源:coupon.py

示例6: initialize

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
	def initialize(self, *a, **kw):
		webapp2.RequestHandler.initialize(self, *a, **kw)
		uid = self.get_cookie('user_id')
		if uid:
			self.current_user = User.get_by_id(int(uid))
		else:
			self.current_user = None

		if self.request.url.endswith('.json'):
			self.format = 'json'
		else:
			self.format = 'html'
开发者ID:arzh,项目名称:CS253,代码行数:14,代码来源:BaseHandler.py

示例7: new_contact

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
 def new_contact(self, token, name, surname):
     """
     Create new contact
     :param token: which returned by user login
     :param name: Name of the new contact
     :param surname: Surname of the new Contact
     :return:
     """
     user = User.get_by_id(token.userid)
     if not user:
         return errors.UserDoesNotFound()
     Contact.new_contact(user._id, name, surname)
     return {}
开发者ID:frm-system,项目名称:frm,代码行数:15,代码来源:contactapi.py

示例8: get

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
  def get(self):
    user_hash = self.request.cookies.get('user')
    user_id = security.validate_hash(user_hash)

    if user_id:
      user = User.get_by_id(long(user_id))

      if user:
        self.response.out.write("Welcome, %s!" % html.escape(user.name))
      else:
          self.redirect("/unit4/signup")
    else:
      self.redirect("/unit4/signup")
开发者ID:gokhanbarisaker,项目名称:CS-253-Web-Development,代码行数:15,代码来源:welcome.py

示例9: toogleYummy

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
def toogleYummy(user_id, post_id):
	user_yummy = User.get_by_id(user_id)
	post_yummy = Post.get_by_id(post_id)
	if (not YummyDone(user_id, post_id)):
		yummy = Yummy(user=user_yummy, post=post_yummy)
		yummy.put()
		return True
	else:
		yummy_delete = Yummy.all()
		yummy_delete.filter("user =", user_yummy)
		yummy_delete.filter("post =", post_yummy)
		db.delete(yummy_delete.get())
		return False
开发者ID:andrefreitas,项目名称:feup-ldso-foodrific,代码行数:15,代码来源:yummy.py

示例10: get

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
  def get(self):
    code = self.request.get('code', '')

    # TODO just use username returned from original request
    acct = Imgur.Account.from_authorization_code(code)

    if acct is None:
      # If we couldn't retrieve the account, nothing more we can do here
      return self.redirect('/')

    user = User.get_by_id(acct.username)

    if user is None:
      User.create_user(acct.username, acct.access_token, acct.refresh_token, acct.access_expiration)

    self.session['username'] = acct.username

    return self.redirect('/')
开发者ID:fjcarnevale,项目名称:redditwalls,代码行数:20,代码来源:handlers.py

示例11: removeAllUsersFollowers

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
def removeAllUsersFollowers(user_id_following):
    user_following = User.get_by_id(user_id_following)
    follow_query = Follow.all()
    follow_query.filter("user_following =", user_following)
    db.delete(follow_query)
开发者ID:andrefreitas,项目名称:feup-ldso-foodrific,代码行数:7,代码来源:follow.py

示例12: user

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
 def user(self):
     if not hasattr(self, "_user"):
         self._user = User.get_by_id(self.user_id)
     return self._user
开发者ID:hay,项目名称:analytics-quarry-web,代码行数:6,代码来源:query.py

示例13: validate_name

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
 def validate_name(form, field):
     user = User.get_by_id(current_user.id)
     if not user.check_name(field.data):
         raise ValidationError("Please pick another name.")
开发者ID:rtx3,项目名称:Salt-MWDS,代码行数:6,代码来源:forms.py

示例14: deleteYummysUser

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
def deleteYummysUser(user_id): 
	yummys = Yummy.all().filter("user =", User.get_by_id(user_id))
	db.delete(yummys)
开发者ID:andrefreitas,项目名称:feup-ldso-foodrific,代码行数:5,代码来源:yummy.py

示例15: initialize

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import get_by_id [as 别名]
 def initialize(self, *a, **kw):
     webapp2.RequestHandler.initialize(self, *a, **kw)
     cookie = self.request.cookies.get('user')
     uid = self.get_cookie(cookie)
     self.user = uid and User.get_by_id(int(uid))
开发者ID:horacix,项目名称:cs253,代码行数:7,代码来源:main.py


注:本文中的user.User.get_by_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。