Fix "AnonymousUser has no attribute 'email'" errors when not logged in

We shouldn't be looking for this attribute unless the user has logged in
- this was a regression in the recent email case fix.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2013-03-28 21:39:00 +00:00
parent cd3a5a7b2a
commit 979fb7980d

View File

@ -76,8 +76,8 @@ class LayerItem(models.Model):
return matches
def user_can_edit(self, user):
user_email = user.email.strip().lower()
if user.is_authenticated():
user_email = user.email.strip().lower()
for maintainer in self.active_maintainers():
if maintainer.email.strip().lower() == user_email:
return True