From: Michael Tremer Date: Sat, 8 Dec 2012 16:26:53 +0000 (+0100) Subject: Fix firstname for users, that did not provide it. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f82e9407cc602fbd4dda8c0dae5f1c5dfce0c06;p=pbs.git Fix firstname for users, that did not provide it. --- diff --git a/backend/users.py b/backend/users.py index 1e506278..01a29b4d 100644 --- a/backend/users.py +++ b/backend/users.py @@ -313,7 +313,12 @@ class User(base.Object): @property def firstname(self): - firstname, rest = self.realname.split(" ", 1) + # Try to split the string into first and last name. + # If that is not successful, return the entire realname. + try: + firstname, rest = self.realname.split(" ", 1) + except: + return self.realname return firstname