Fix broken User link name (it was possible to change link name to one that was already used, validation was not working correctly).
Patch by: Pawel Solyga
--- a/app/soc/views/models/user.py Tue Nov 11 01:02:56 2008 +0000
+++ b/app/soc/views/models/user.py Tue Nov 11 19:49:00 2008 +0000
@@ -68,7 +68,7 @@
properties = {'link_name': link_name}
user = soc.logic.models.user.logic.getForFields(properties, unique=True)
- if user and user.link_name != link_name:
+ if user and user.link_name == link_name:
raise forms.ValidationError("This link name is already in use.")
return link_name
--- a/app/soc/views/user/profile.py Tue Nov 11 01:02:56 2008 +0000
+++ b/app/soc/views/user/profile.py Tue Nov 11 19:49:00 2008 +0000
@@ -62,7 +62,7 @@
user = id_user.getUserFromLinkName(link_name)
- if user and not id_user.doesLinkNameBelongToId(link_name, user.id):
+ if user:
raise forms.ValidationError("This link name is already in use.")
return link_name