# HG changeset patch # User Pawel Solyga # Date 1221828313 0 # Node ID b62f1cf5e878f51eab50037be7a3b3561cbe226a # Parent 1fadf6e0348d45cdeb009f70efda6c024c67d8a2 Bug fixes to revision r596. User Account field in Developer User Profile view needs to be an email not a login name. Header title of User Profile Developer view, when form validation failes is now showing correct value ("Modify existing ..." instead of "Create new user ..."). diff -r 1fadf6e0348d -r b62f1cf5e878 app/soc/templates/soc/site/user/profile/edit.html --- a/app/soc/templates/soc/site/user/profile/edit.html Fri Sep 19 05:15:20 2008 +0000 +++ b/app/soc/templates/soc/site/user/profile/edit.html Fri Sep 19 12:45:13 2008 +0000 @@ -23,7 +23,7 @@ {% block header_title %} {% if existing_user %} Modify Existing User Profile for {{ existing_user.nick_name }} - <{{ existing_user.id }}> + <{{ existing_user.id.email }}> {% else %} Create a New User Profile {% endif %} diff -r 1fadf6e0348d -r b62f1cf5e878 app/soc/views/site/user/profile.py --- a/app/soc/views/site/user/profile.py Fri Sep 19 05:15:20 2008 +0000 +++ b/app/soc/views/site/user/profile.py Fri Sep 19 12:45:13 2008 +0000 @@ -148,7 +148,7 @@ if user: # User entity found, so populate form with existing User information # context['found_user'] = user - form = LookupForm(initial={'id': user.id, + form = LookupForm(initial={'id': user.id.email, 'link_name': user.link_name}) if request.path.endswith('lookup'): @@ -236,6 +236,13 @@ user = None # assume that no User entity will be found + # try to fetch User entity corresponding to linkname if one exists + try: + user = id_user.getUserIfLinkName(linkname) + except out_of_band.ErrorResponse, error: + # show custom 404 page when link name doesn't exist in Datastore + return simple.errorResponse(request, error, template, context) + if request.method == 'POST': form = EditForm(request.POST) @@ -249,7 +256,7 @@ form_id, link_name=new_linkname, nick_name=nickname, is_developer=is_developer) - # redirect to new /site/user/profile/new_linkname&s=0 + # redirect to new /site/user/profile/new_linkname?s=0 # (causes 'Profile saved' message to be displayed) return response_helpers.redirectToChangedSuffix( request, linkname, new_linkname, @@ -257,8 +264,6 @@ else: # method == 'GET': # try to fetch User entity corresponding to link name if one exists if linkname: - user = id_user.getUserFromLinkName(linkname) - if user: # is 'Profile saved' parameter present, but referrer was not ourself? # (e.g. someone bookmarked the GET that followed the POST submit) @@ -277,7 +282,7 @@ # populate form with the existing User entity form = EditForm(initial={ - 'id': user.id, 'link_name': user.link_name, + 'id': user.id.email, 'link_name': user.link_name, 'nick_name': user.nick_name, 'is_developer': user.is_developer}) else: if request.GET.get(profile.SUBMIT_MSG_PARAM_NAME):