]> git.ipfire.org Git - people/jschlag/pbs.git/commitdiff
Fix firstname for users, that did not provide it.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 8 Dec 2012 16:26:53 +0000 (17:26 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 8 Dec 2012 16:26:53 +0000 (17:26 +0100)
backend/users.py

index 1e506278fbf97023bb206d12a2815070fbbd876b..01a29b4d7da92f61bbfd7ec715e84efc2b8ddd44 100644 (file)
@@ -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