diff orpg/mapper/map_msg.py @ 20:072ffc1d466f traipse_dev

2nd attempt. Still untested.
author sirebral
date Sat, 25 Jul 2009 19:23:25 -0500
parents 78407d627cba
children 449a8900f9ac
line wrap: on
line diff
--- a/orpg/mapper/map_msg.py	Sat Jul 25 17:24:40 2009 -0500
+++ b/orpg/mapper/map_msg.py	Sat Jul 25 19:23:25 2009 -0500
@@ -79,15 +79,13 @@
                     else:
                         print "Unrecognized tag " + name + " found in map_msg.init_from_dom - skipping"
                         continue
-                try:
-                    self.children[name].init_from_dom(c)
+                try: self.children[name].init_from_dom(c)
                 except Exception, e:
                     print "map_msg.init_from_dom() exception: "+str(e)
                     continue
         else:
             self.p_lock.release()
-            raise Exception, 
-                "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element"
+            raise Exception, "Error attempting to initialize a " + self.tagname + " from a non-<" + self.tagname + "/> element"
         self.p_lock.release()
 
     def set_from_dom(self,xml_dom):
@@ -104,28 +102,21 @@
             for c in xml_dom._get_childNodes():
                 name = c._get_nodeName()
                 if not self.children.has_key(name):
-                    if name == "miniatures":
-                        self.children[name] = minis_msg(self.p_lock)
-                    elif name == "grid":
-                        self.children[name] = grid_msg(self.p_lock)
-                    elif name == "bg":
-                        self.children[name] = bg_msg(self.p_lock)
-                    elif name == "whiteboard":
-                        self.children[name] = whiteboard_msg(self.p_lock)
-                    elif name == "fog":
-                        self.children[name] = fog_msg(self.p_lock)
+                    if name == "miniatures": self.children[name] = minis_msg(self.p_lock)
+                    elif name == "grid": self.children[name] = grid_msg(self.p_lock)
+                    elif name == "bg": self.children[name] = bg_msg(self.p_lock)
+                    elif name == "whiteboard": self.children[name] = whiteboard_msg(self.p_lock)
+                    elif name == "fog": self.children[name] = fog_msg(self.p_lock)
                     else:
                         print "Unrecognized tag " + name + " found in map_msg.init_from_dom - skipping"
                         continue
-                try:
-                    self.children[name].set_from_dom(c)
+                try: self.children[name].set_from_dom(c)
                 except Exception, e:
                     print "map_msg.set_from_dom() exception: "+str(e)
                     continue
         else:
             self.p_lock.release()
-            raise Exception, 
-                "Error attempting to set a " + self.tagname + " from a non-<" + self.tagname + "/> element in map"
+            raise Exception, "Error attempting to set a " + self.tagname + " from a non-<" + self.tagname + "/> element in map"
         self.p_lock.release()
 
     def get_all_xml(self, action="new", output_action=1):