]> git.openstreetmap.org Git - osqa.git/commitdiff
adding a try-except block that listens for AttributeError for the find_by_name and...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sat, 21 May 2011 19:39:57 +0000 (19:39 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Sat, 21 May 2011 19:39:57 +0000 (19:39 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1045 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/modules/ui.py

index 26941104d8a35d61198dc202b4dfc0de5ed58cf4..114885b6999f56e59110777cd1bb03e62ff6f14f 100644 (file)
@@ -11,13 +11,19 @@ class Registry(list):
 
     def find_by_name(self, name):
         for i in self:
-            if i.name and (i.name == name):
-                return i
+            try:
+                if i.name and (i.name == name):
+                    return i
+            except AttributeError:
+                pass
 
     def remove_by_name(self, name):
         for i, r in enumerate(self):
-            if r.name and (r.name == name):
-                return self.pop(i)
+            try:
+                if r.name and (r.name == name):
+                    return self.pop(i)
+            except AttributeError:
+                pass
 
 
 HEAD_CONTENT = 'HEAD_CONTENT'