app/soc/logic/accounts.py
changeset 512 aae25d2b4464
parent 499 d22e4fe8e64b
child 543 280a1ac6bcc1
equal deleted inserted replaced
511:52557918ec8f 512:aae25d2b4464
   111   # email does not already belong to this User, but to some other User
   111   # email does not already belong to this User, but to some other User
   112   return False
   112   return False
   113 
   113 
   114 
   114 
   115 # TODO(tlarsen): make this generic for any Linkable and move elsewhere
   115 # TODO(tlarsen): make this generic for any Linkable and move elsewhere
   116 def getUserFromLinkNameOr404(link_name):
   116 def getUserFromLinkIdOr404(link_id):
   117   """Like getUserFromLinkName but expects to find a user.
   117   """Like getUserFromLinkId but expects to find a user.
   118 
   118 
   119   Raises:
   119   Raises:
   120     out_of_band.ErrorResponse if no User entity is found
   120     out_of_band.ErrorResponse if no User entity is found
   121   """
   121   """
   122   user = models.user.logic.getForFields({'link_name': link_name},
   122   user = models.user.logic.getForFields({'link_id': link_id},
   123                                         unique=True)
   123                                         unique=True)
   124 
   124 
   125   if user:
   125   if user:
   126     return user
   126     return user
   127 
   127 
   128   raise out_of_band.ErrorResponse(
   128   raise out_of_band.ErrorResponse(
   129       'There is no user with a "link name" of "%s".' % link_name, status=404)
   129       'There is no user with a "link ID" of "%s".' % link_id, status=404)