thirdparty/google_appengine/google/appengine/api/users.py
changeset 1278 a7766286a7be
parent 109 620f9b141567
child 2273 e4cb9c53db3e
equal deleted inserted replaced
1277:5c931bd3dc1e 1278:a7766286a7be
    18 """Python datastore class User to be used as a datastore data type.
    18 """Python datastore class User to be used as a datastore data type.
    19 
    19 
    20 Classes defined here:
    20 Classes defined here:
    21   User: object representing a user.
    21   User: object representing a user.
    22   Error: base exception type
    22   Error: base exception type
    23   BadRequestError: UserService exception
       
    24   UserNotFoundError: UserService exception
    23   UserNotFoundError: UserService exception
    25   BackendError: UserService exception
    24   RedirectTooLongError: UserService exception
       
    25   NotAllowedError: UserService exception
    26 """
    26 """
    27 
    27 
    28 
    28 
    29 
    29 
    30 
    30 
    46   logged in."""
    46   logged in."""
    47 
    47 
    48 
    48 
    49 class RedirectTooLongError(Error):
    49 class RedirectTooLongError(Error):
    50   """Raised by UserService calls if the generated redirect URL was too long.
    50   """Raised by UserService calls if the generated redirect URL was too long.
       
    51   """
       
    52 
       
    53 class NotAllowedError(Error):
       
    54   """Raised by UserService calls if the requested redirect URL is not allowed.
    51   """
    55   """
    52 
    56 
    53 
    57 
    54 class User(object):
    58 class User(object):
    55   """A user.
    59   """A user.
   145     apiproxy_stub_map.MakeSyncCall('user', 'CreateLoginURL', req, resp)
   149     apiproxy_stub_map.MakeSyncCall('user', 'CreateLoginURL', req, resp)
   146   except apiproxy_errors.ApplicationError, e:
   150   except apiproxy_errors.ApplicationError, e:
   147     if (e.application_error ==
   151     if (e.application_error ==
   148         user_service_pb.UserServiceError.REDIRECT_URL_TOO_LONG):
   152         user_service_pb.UserServiceError.REDIRECT_URL_TOO_LONG):
   149       raise RedirectTooLongError
   153       raise RedirectTooLongError
       
   154     elif (e.application_error ==
       
   155         user_service_pb.UserServiceError.NOT_ALLOWED):
       
   156       raise NotAllowedError
   150     else:
   157     else:
   151       raise e
   158       raise e
   152   return resp.value()
   159   return resp.value()
   153 
   160 
   154 CreateLoginURL = create_login_url
   161 CreateLoginURL = create_login_url