app/soc/views/site/user/profile.py
changeset 331 24edc648ad3f
parent 325 1469eff8f59e
child 332 3a04703a7fe3
--- a/app/soc/views/site/user/profile.py	Tue Oct 14 22:20:55 2008 +0000
+++ b/app/soc/views/site/user/profile.py	Tue Oct 14 22:35:46 2008 +0000
@@ -273,8 +273,14 @@
   user = None  # assume that no User entity will be found
 
   # try to fetch User entity corresponding to link_name if one exists
-  if link_name:
-    user = id_user.getUserFromLinkName(link_name)
+  try:
+    if link_name:
+      user = id_user.getUserFromLinkNameOrDie(link_name)
+  except out_of_band.ErrorResponse, error:
+    # show custom 404 page when link name doesn't exist in Datastore
+    error.message = error.message + DEF_CREATE_NEW_USER_MSG
+    return simple.errorResponse(request, error, template, context)
+
 
   if request.method == 'POST':
     form = EditForm(request.POST)