From 62ffb4379504fe6878e4499803bca472ea546ebf Mon Sep 17 00:00:00 2001 From: Michael Ziegler Date: Sun, 21 Feb 2010 17:47:42 +0100 Subject: [PATCH] fix "new user" dialog being broken by getAdmin trying to access a not-yet-set ForeignKey. --- pyweb/mumble/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyweb/mumble/models.py b/pyweb/mumble/models.py index 95fde3a..9c8d528 100644 --- a/pyweb/mumble/models.py +++ b/pyweb/mumble/models.py @@ -537,10 +537,15 @@ class MumbleUser( models.Model ): # Admin handlers def getAdmin( self ): """ Get ACL of root Channel, get the admin group and see if this user is in it. """ - return self.server.rootchan.acl.group_has_member( "admin", self.mumbleid ); + if self.mumbleid == -1: + return False; + else: + return self.server.rootchan.acl.group_has_member( "admin", self.mumbleid ); def setAdmin( self, value ): """ Set or revoke this user's membership in the admin group on the root channel. """ + if self.mumbleid == -1: + return False; if value: self.server.rootchan.acl.group_add_member( "admin", self.mumbleid ); else: