diff --git a/organize/interfaces.py b/organize/interfaces.py index e550049..b39e841 100644 --- a/organize/interfaces.py +++ b/organize/interfaces.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Helmut Merz helmutm@cy55.de +# Copyright (c) 2015 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -67,10 +67,13 @@ class UserId(schema.TextLine): mapping={'userId': userId})) person = getPersonForUser(context, principal=principal) if person is not None and person != context: - raiseValidationError( - _(u'There is alread a person ($person) assigned to user $userId.', - mapping=dict(person=zapi.getName(person), - userId=userId))) + name = zapi.getName(person) + if name: + raiseValidationError( + _(u'There is already a person ($person) ' + u'assigned to user $userId.', + mapping=dict(person=name, + userId=userId))) class LoginName(schema.TextLine): @@ -82,7 +85,7 @@ class LoginName(schema.TextLine): super(LoginName, self)._validate(userId) if userId in getPrincipalFolder(self.context): raiseValidationError( - _(u'There is alread a user with ID $userId.', + _(u'There is already a user with ID $userId.', mapping=dict(userId=userId))) diff --git a/organize/party.py b/organize/party.py index c83ac40..7cfd52c 100644 --- a/organize/party.py +++ b/organize/party.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2014 Helmut Merz helmutm@cy55.de +# Copyright (c) 2015 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -93,9 +93,11 @@ class Person(AdapterBase, BasePerson): return person = getPersonForUser(self.context, principal=principal) if person is not None and person != self.context: - raise ValueError( - 'There is alread a person (%s) assigned to user %s.' - % (getName(person), userId)) + name = getName(person) + if name: + raise ValueError( + 'There is already a person (%s) assigned to user %s.' + % (getName(person), userId)) pa = annotations(principal) loopsId = util.getUidForObject(self.context.getLoopsRoot()) ann = pa.get(ANNOTATION_KEY)