Fix some defects for lookup user view. More information about the patch can be found under the link below.
http://groups.google.com/group/melange-soc-dev/browse_thread/thread/5d378c8d3679945f/d1e7cc3a53adda4e
Patch by: Chen Lunpeng
Review by: Pawel Solyga
--- a/app/soc/views/site/user/profile.py Tue Oct 14 16:10:07 2008 +0000
+++ b/app/soc/views/site/user/profile.py Tue Oct 14 20:33:20 2008 +0000
@@ -119,6 +119,7 @@
form = None # assume blank form needs to be displayed
lookup_message = ugettext_lazy('Enter information to look up a User.')
email_error = None # assume no email look-up errors
+ context['lookup_link'] = None
if request.method == 'POST':
form = LookupForm(request.POST)
@@ -151,17 +152,22 @@
if user:
lookup_message = ugettext_lazy('User found by link name.')
- email_error = None # clear previous error, since User was found
+ # clear previous error, since User was found
+ email_error = None
+ # clear previous lookup_link, since User was found, the lookup_link
+ # is not needed to display.
+ context['lookup_link'] = None
else:
context['link_name_error'] = ugettext_lazy(
'User with that link name not found.')
- range_width = helper.lists.getPreferredListPagination()
- nearest_user_range_start = id_user.findNearestUsersOffset(
- range_width, link_name=link_name)
+ if context['lookup_link'] is None:
+ range_width = helper.lists.getPreferredListPagination()
+ nearest_user_range_start = id_user.findNearestUsersOffset(
+ range_width, link_name=link_name)
- if nearest_user_range_start is not None:
- context['lookup_link'] = './list?offset=%s&limit=%s' % (
- nearest_user_range_start, range_width)
+ if nearest_user_range_start is not None:
+ context['lookup_link'] = './list?offset=%s&limit=%s' % (
+ nearest_user_range_start, range_width)
# else: form was not valid
# else: # method == 'GET'