Commit 798d4576 authored by Ivan Tyagov's avatar Ivan Tyagov

Do not raise ValueError when searching for an ERP5 user which do not exists or...

Do not raise ValueError when searching for an ERP5 user which do not exists or due to security settings is not accessible to logged in user. Instead return None and let application logic choose appropriate action.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25310 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c5b25560
...@@ -64,8 +64,7 @@ found_user_list = context.portal_catalog(portal_type=\'Person\', \n ...@@ -64,8 +64,7 @@ found_user_list = context.portal_catalog(portal_type=\'Person\', \n
reference=user_name)\n reference=user_name)\n
found_users = len(found_user_list)\n found_users = len(found_user_list)\n
if found_users != 1:\n if found_users != 1:\n
# in an ERP5 system there can exists only one unique username\n return None\n
raise ValueError, "Found %s users for username \'%s\'" %(found_users, user_name)\n
\n \n
return found_user_list[0].getObject()\n return found_user_list[0].getObject()\n
</string> </value> </string> </value>
...@@ -111,7 +110,6 @@ return found_user_list[0].getObject()\n ...@@ -111,7 +110,6 @@ return found_user_list[0].getObject()\n
<string>found_user_list</string> <string>found_user_list</string>
<string>len</string> <string>len</string>
<string>found_users</string> <string>found_users</string>
<string>ValueError</string>
<string>_getitem_</string> <string>_getitem_</string>
</tuple> </tuple>
</value> </value>
......
513 514
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment