diff orpg/mapper/map.py @ 231:cc7629ab526d alpha

Traipse Alpha 'OpenRPG' {100614-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary (Closing/Closed) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order New to Server GUI, can now clear log Fixes: Fix to InterParse that was causing an Infernal Loop with Namespace Internal Fix to XML data, removed old Minidom and switched to Element Tree Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread Fix to metaservers.xml file not being created Fix to Single and Double quotes in Whiteboard text Fix to Background images not showing when using the Image Server Fix to Duplicate chat names appearing Fix to Server GUI's logging output Fix to FNB.COLORFUL_TABS bug.
author sirebral
date Mon, 14 Jun 2010 15:20:08 -0500
parents 24769389a7ba
children
line wrap: on
line diff
--- a/orpg/mapper/map.py	Sun Jun 13 19:06:02 2010 -0500
+++ b/orpg/mapper/map.py	Mon Jun 14 15:20:08 2010 -0500
@@ -677,11 +677,12 @@
         except: pass
 
     def re_ids_in_xml(self, xml):
-        debug(('Developers note. Deprecated call to re_ids_in_xml!!'), parents=True)
+        exception = "\nDeprecated call to: Function re_ids_in_xml, line 679, map.py\nThis can mangle XML, please report!"
+        logger.exception(exception)
         new_xml = ""
         tmp_map = map_msg()
-        xml_dom = parseXml(str(xml))
-        node_list = xml_dom.getElementsByTagName("map")
+        xml_dom = fromstring(xml)
+        node_list = xml_dom.findall("map")
         if len(node_list) < 1: pass
         else:
             tmp_map.init_from_dom(node_list[0])
@@ -709,8 +710,7 @@
                             elif l.tagname == 'circle': id = 'circle-' + self.frame.session.get_next_id()
                             l.init_prop("id", id)
             new_xml = tmp_map.get_all_xml()
-        if xml_dom: xml_dom.unlink()
-        return str(new_xml)
+        return new_xml
 
 class map_wnd(wx.Panel):
     def __init__(self, parent, id):
@@ -789,9 +789,9 @@
         d = wx.FileDialog(self.GetParent(), "Select a file", dir_struct["user"], "", "*.xml", wx.OPEN)
         if d.ShowModal() == wx.ID_OK:
             f = open(d.GetPath())
-            map_string = f.read()
-            new_xml = self.canvas.re_ids_in_xml(map_string)
-            if new_xml:
+            new_xml = f.read()
+            f.close()
+            if new_xml != None:
                 self.canvas.takexml(new_xml)
                 self.canvas.send_map_data("new")
                 self.update_tools()