Fix a couple more bugs
authorEric Price <ecprice@mit.edu>
Tue, 3 Jun 2008 03:45:44 +0000 (23:45 -0400)
committerEric Price <ecprice@mit.edu>
Tue, 3 Jun 2008 03:45:44 +0000 (23:45 -0400)
svn path=/trunk/packages/sipb-xen-www/; revision=576

code/main.py
code/validation.py

index 8a5c178..fdc2837 100755 (executable)
@@ -160,7 +160,7 @@ def create(username, state, fields):
     else:
         err = None
     state.clear() #Changed global state
-    d = getListDict(username)
+    d = getListDict(username, state)
     d['err'] = err
     if err:
         for field in fields.keys():
@@ -335,7 +335,7 @@ def command(username, state, fields):
             return templates.command(searchList=[d])
     if back == 'list':
         state.clear() #Changed global state
-        d = getListDict(username)
+        d = getListDict(username, state)
         d['result'] = result
         return templates.list(searchList=[d])
     elif back == 'info':
index caa8ce2..7eb1b4f 100644 (file)
@@ -241,7 +241,7 @@ def testOwner(user, owner, machine=None):
     return owner
 
 def testContact(user, contact, machine=None):
-    if contact in (None, machine.contact):
+    if contact is None or (machine is not None and contact == machine.contact):
         return None
     if not re.match("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", contact, re.I):
         raise InvalidInput('contact', contact, "Not a valid email.")