thirdparty/google_appengine/google/appengine/api/users.py
changeset 3031 7678f72140e6
parent 2864 2e0b0af889be
equal deleted inserted replaced
3030:09cae668b536 3031:7678f72140e6
   149       return NotImplemented
   149       return NotImplemented
   150     return cmp((self.__email, self.__auth_domain),
   150     return cmp((self.__email, self.__auth_domain),
   151                (other.__email, other.__auth_domain))
   151                (other.__email, other.__auth_domain))
   152 
   152 
   153 
   153 
   154 def create_login_url(dest_url):
   154 def create_login_url(dest_url, _auth_domain=None):
   155   """Computes the login URL for this request and specified destination URL.
   155   """Computes the login URL for this request and specified destination URL.
   156 
   156 
   157   Args:
   157   Args:
   158     dest_url: String that is the desired final destination URL for the user
   158     dest_url: String that is the desired final destination URL for the user
   159               once login is complete. If 'dest_url' does not have a host
   159               once login is complete. If 'dest_url' does not have a host
   163     string
   163     string
   164   """
   164   """
   165   req = user_service_pb.CreateLoginURLRequest()
   165   req = user_service_pb.CreateLoginURLRequest()
   166   resp = user_service_pb.CreateLoginURLResponse()
   166   resp = user_service_pb.CreateLoginURLResponse()
   167   req.set_destination_url(dest_url)
   167   req.set_destination_url(dest_url)
       
   168   if _auth_domain:
       
   169     req.set_auth_domain(_auth_domain)
       
   170 
   168   try:
   171   try:
   169     apiproxy_stub_map.MakeSyncCall('user', 'CreateLoginURL', req, resp)
   172     apiproxy_stub_map.MakeSyncCall('user', 'CreateLoginURL', req, resp)
   170   except apiproxy_errors.ApplicationError, e:
   173   except apiproxy_errors.ApplicationError, e:
   171     if (e.application_error ==
   174     if (e.application_error ==
   172         user_service_pb.UserServiceError.REDIRECT_URL_TOO_LONG):
   175         user_service_pb.UserServiceError.REDIRECT_URL_TOO_LONG):
   179   return resp.login_url()
   182   return resp.login_url()
   180 
   183 
   181 CreateLoginURL = create_login_url
   184 CreateLoginURL = create_login_url
   182 
   185 
   183 
   186 
   184 def create_logout_url(dest_url):
   187 def create_logout_url(dest_url, _auth_domain=None):
   185   """Computes the logout URL for this request and specified destination URL.
   188   """Computes the logout URL for this request and specified destination URL.
   186 
   189 
   187   Args:
   190   Args:
   188     dest_url: String that is the desired final destination URL for the user
   191     dest_url: String that is the desired final destination URL for the user
   189               once logout is complete. If 'dest_url' does not have a host
   192               once logout is complete. If 'dest_url' does not have a host
   193     string
   196     string
   194   """
   197   """
   195   req = user_service_pb.CreateLogoutURLRequest()
   198   req = user_service_pb.CreateLogoutURLRequest()
   196   resp = user_service_pb.CreateLogoutURLResponse()
   199   resp = user_service_pb.CreateLogoutURLResponse()
   197   req.set_destination_url(dest_url)
   200   req.set_destination_url(dest_url)
       
   201   if _auth_domain:
       
   202     req.set_auth_domain(_auth_domain)
       
   203 
   198   try:
   204   try:
   199     apiproxy_stub_map.MakeSyncCall('user', 'CreateLogoutURL', req, resp)
   205     apiproxy_stub_map.MakeSyncCall('user', 'CreateLogoutURL', req, resp)
   200   except apiproxy_errors.ApplicationError, e:
   206   except apiproxy_errors.ApplicationError, e:
   201     if (e.application_error ==
   207     if (e.application_error ==
   202         user_service_pb.UserServiceError.REDIRECT_URL_TOO_LONG):
   208         user_service_pb.UserServiceError.REDIRECT_URL_TOO_LONG):