changeset 122:36919b8a3ef9 alpha

Traipse Alpha 'OpenRPG' {091031-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 (Cleaning up for Beta) Added Bookmarks Fix to Remote Admin Commands Minor fix to text based Server Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager default_manifest.xml renamed to default_upmana.xml Cleaner clode for saved repositories New TrueDebug Class in orpg_log Mercurial's hgweb folder is ported to upmana Happy Halloween!
author sirebral
date Sat, 31 Oct 2009 22:07:55 -0500
parents 496dbf12a6cb
children 174658f839c0
files orpg/mapper/background_msg.py orpg/mapper/base_msg.py orpg/mapper/fog_msg.py orpg/mapper/grid_msg.py orpg/mapper/map_msg.py orpg/mapper/miniatures_msg.py orpg/mapper/whiteboard_msg.py orpg/networking/meta_server_lib.py orpg/networking/mplay_client.py orpg/networking/mplay_groups.py orpg/networking/mplay_server.py orpg/networking/mplay_server_gui.py orpg/orpg_version.py orpg/plugindb.py orpg/tools/orpg_log.py orpg/tools/pluginui.py orpg/tools/predTextCtrl.py upmana/default_manifest.xml upmana/default_upmana.xml upmana/manifest.py upmana/mercurial/hgweb/hgweb_mod.py upmana/mercurial/hgweb/hgwebdir_mod.py upmana/mercurial/hgweb/protocol.py upmana/mercurial/hgweb/request.py upmana/mercurial/hgweb/server.py upmana/mercurial/hgweb/webcommands.py upmana/mercurial/hgweb/webutil.py upmana/mercurial/hgweb/wsgicgi.py
diffstat 28 files changed, 710 insertions(+), 628 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/mapper/background_msg.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/mapper/background_msg.py	Sat Oct 31 22:07:55 2009 -0500
@@ -27,7 +27,8 @@
 #
 __version__ = "$Id: background_msg.py,v 1.8 2006/11/04 21:24:21 digitalxero Exp $"
 
-from base_msg import *
+from base_msg import map_element_msg_base
+from xml.etree.ElementTree import ElementTree
 
 class bg_msg(map_element_msg_base):
 
--- a/orpg/mapper/base_msg.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/mapper/base_msg.py	Sat Oct 31 22:07:55 2009 -0500
@@ -30,15 +30,15 @@
 from threading import RLock
 from orpg.networking.mplay_client import *
 
-from xml.etree.ElementTree import XML
+from xml.etree.ElementTree import XML, fromstring, parse
 
 class map_element_msg_base:
 #  This is a base class
 
     def __init__(self,reentrant_lock_object = None):
 
-        if not hasattr(self,"tagname"):
-            raise Exception, "This is a virtual class that cannot be directly instantiated.  Set self.tagname in derived class."
+        if not self.tagname:
+            raise Exception, "This is a virtual class that cannot be directly instantiated.  Set self.tagname in derived class."; exit()
 
         self._props = {}
         #  This is a dictionary that holds (value,changed) 2-tuples, indexed by attribute
@@ -202,36 +202,33 @@
         if xml.tag == self.tagname:
             if xml.keys():
                 for k in xml.keys():
-                    prop_func(k,xml.get(k))
+                    prop_func(k, xml.get(k))
         else:
             self.p_lock.release()
             raise Exception, "Error attempting to modify a " + self.tagname + " from a non-<" + self.tagname + "/> element"
         self.p_lock.release()
 
-    def init_from_dom(self,xml):
+    def init_from_dom(self, xml):
     #  xml must be pointing to an empty tag.  Override in a derived class for <map/> and other similar tags.
         self._from_dom(xml,self.init_prop)
 
-    def set_from_dom(self,xml):
+    def set_from_dom(self, xml):
     #  xml must be pointing to an empty tag.  Override in a derived class for <map/> and other similar tags
-        self._from_dom(xml,self.set_prop)
+        self._from_dom(xml, self.set_prop)
 
-    def init_from_xml(self,xmlString):
-        tree = XML(xmlString)
+    def init_from_xml(self, tree):
+        #tree = XML(xmlString)
         node_list = tree.findall(self.tagname)
-        if len(node_list) < 1:
-            print "Warning: no <" + self.tagname + "/> elements found in DOM."
+        if len(node_list) < 1: print "Warning: no <" + self.tagname + "/> elements found in DOM."
         else:
             while len(node_list):
                 self.init_from_dom(node_list.pop())
 
-    def set_from_xml(self,xmlString):
-        tree = XML(xmlString)
+    def set_from_xml(self, tree):
+        #tree = XML(xmlString)
         node_list = tree.findall(self.tagname)
-        if len(node_list) < 1:
-            print "Warning: no <" + self.tagname + "/> elements found in DOM."
+        if len(node_list) < 1: print "Warning: no <" + self.tagname + "/> elements found in DOM."
         else:
-            while len(node_list):
-                self.set_from_dom(node_list.pop())
+            while len(node_list): self.set_from_dom(node_list.pop())
     # XML importers end
     #########################################
--- a/orpg/mapper/fog_msg.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/mapper/fog_msg.py	Sat Oct 31 22:07:55 2009 -0500
@@ -27,13 +27,14 @@
 
 from base_msg import *
 from region import *
-from orpg.minidom import Element
+#from orpg.minidom import Element
 import string
+from xml.etree.ElementTree import ElementTree
 
 class fog_msg(map_element_msg_base):
 
     def __init__(self,reentrant_lock_object = None):
-        self.tagname = "fog"
+        self.tag = "fog"
         map_element_msg_base.__init__(self,reentrant_lock_object)
         self.use_fog = 0
         self.fogregion=IRegion()
@@ -41,16 +42,16 @@
 
     def get_line(self,outline,action,output_act):
         elem = Element( "poly" )
-        if ( output_act ): elem.setAttribute( "action", action )
-        if ( outline == 'all' ) or ( outline == 'none' ): elem.setAttribute( "outline", outline )
+        if ( output_act ): elem.set( "action", action )
+        if ( outline == 'all' ) or ( outline == 'none' ): elem.set( "outline", outline )
         else:
-            elem.setAttribute( "outline", "points" )
+            elem.set( "outline", "points" )
             for pair in string.split( outline, ";" ):
                 p = string.split( pair, "," )
                 point = Element( "point" )
-                point.setAttribute( "x", p[ 0 ] )
-                point.setAttribute( "y", p[ 1 ] )
-                elem.appendChild( point )
+                point.set( "x", p[ 0 ] )
+                point.set( "y", p[ 1 ] )
+                elem.append( point )
         str = elem.toxml()
         elem.unlink()
         return str
@@ -94,11 +95,11 @@
     def interpret_dom(self,xml_dom):
         self.use_fog=1
         #print 'fog_msg.interpret_dom called'
-        children = xml_dom._get_childNodes()
+        children = xml_dom.getchildren()
         #print "children",children
         for l in children:
-            action = l.getAttribute("action")
-            outline = l.getAttribute("outline")
+            action = l.get("action")
+            outline = l.get("outline")
             #print "action/outline",action, outline
             if (outline=="all"):
                 polyline=[]
@@ -109,9 +110,9 @@
                 self.fogregion.Clear()
             else:
                 polyline=[]
-                list = l._get_childNodes()
+                list = l.getchildren()
                 for node in list:
-                    polyline.append( IPoint().make( int(node.getAttribute("x")), int(node.getAttribute("y")) ) )
+                    polyline.append( IPoint().make( int(node.get("x")), int(node.get("y")) ) )
                     # pointarray = outline.split(";")
                     # for m in range(len(pointarray)):
                     #     pt=pointarray[m].split(",")
--- a/orpg/mapper/grid_msg.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/mapper/grid_msg.py	Sat Oct 31 22:07:55 2009 -0500
@@ -30,8 +30,10 @@
 from base_msg import map_element_msg_base
 #from base_msg import * ## ?? import all? Deprecated!?
 
+from xml.etree.ElementTree import ElementTree
+
 class grid_msg(map_element_msg_base):
 
     def __init__(self,reentrant_lock_object = None):
         self.tagname = "grid"
-        map_element_msg_base.__init__(self,reentrant_lock_object)
+        map_element_msg_base.__init__(self, reentrant_lock_object)
--- a/orpg/mapper/map_msg.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/mapper/map_msg.py	Sat Oct 31 22:07:55 2009 -0500
@@ -27,13 +27,18 @@
 #
 __version__ = "$Id: map_msg.py,v 1.16 2007/03/09 14:11:55 digitalxero Exp $"
 
-#from base import *
+from base import *
 from base_msg import *
 from background_msg import *
 from grid_msg import *
 from miniatures_msg import *
 from whiteboard_msg import *
 from fog_msg import *
+import traceback
+from orpg.dirpath import dir_struct
+
+from xml.etree.ElementTree import ElementTree, Element, iselement
+from xml.etree.ElementTree import fromstring, tostring, parse
 
 """
 <map name=? id=? >
@@ -46,25 +51,37 @@
 
 """
 
+def Crash(type, value, crash):
+    crash_report = open(dir_struct["home"] + 'crash-report.txt', "w")
+    traceback.print_exception(type, value, crash, file=crash_report)
+    crash_report.close()
+    msg = ''
+    crash_report = open(dir_struct["home"] + 'crash-report.txt', "r")
+    for line in crash_report: msg += line
+    print msg
+    crash_report.close()
+
 class map_msg(map_element_msg_base):
 
     def __init__(self,reentrant_lock_object = None):
+        print 'class map_msg'
         self.tagname = "map"
-        map_element_msg_base.__init__(self,reentrant_lock_object)
+        map_element_msg_base.__init__(self, reentrant_lock_object)
 
-    def init_from_dom(self,xml_dom):
+    def init_from_dom(self, xml_dom):
+        print 'init_from_dom', self.tagname
         self.p_lock.acquire()
-        if xml_dom.tagName == self.tagname:
+        if xml_dom.tag == self.tagname:
             # If this is a map message, look for the "action=new"
             # Notice we only do this when the root is a map tag
-            if self.tagname == "map" and xml_dom.hasAttribute("action") and xml_dom.getAttribute("action") == "new":
+            if self.tagname == "map" and xml_dom.get("action") == "new":
                 self.clear()
             # Process all of the properties in each tag
-            if xml_dom.getAttributeKeys():
-                for k in xml_dom.getAttributeKeys():
-                    self.init_prop(k,xml_dom.getAttribute(k))
-            for c in xml_dom._get_childNodes():
-                name = c._get_nodeName()
+            if xml_dom.keys():
+                for k in xml_dom.keys():
+                    self.init_prop(k, xml_dom.get(k))
+            for c in xml_dom.getchildren():
+                name = c.tag
                 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)
@@ -84,18 +101,19 @@
         self.p_lock.release()
 
     def set_from_dom(self,xml_dom):
+        print 'set_from_dom'
         self.p_lock.acquire()
-        if xml_dom.tagName == self.tagname:
+        if xml_dom.tag == self.tagname:
             # If this is a map message, look for the "action=new"
             # Notice we only do this when the root is a map tag
-            if self.tagname == "map" and xml_dom.hasAttribute("action") and xml_dom.getAttribute("action") == "new":
+            if self.tagname == "map" and xml_dom.get("action") == "new":
                 self.clear()
             # Process all of the properties in each tag
-            if xml_dom.getAttributeKeys():
-                for k in xml_dom.getAttributeKeys():
-                    self.set_prop(k,xml_dom.getAttribute(k))
-            for c in xml_dom._get_childNodes():
-                name = c._get_nodeName()
+            if xml_dom.keys():
+                for k in xml_dom.keys():
+                    self.set_prop(k,xml_dom.get(k))
+            for c in xml_dom.getchildren():
+                name = c.tag
                 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)
@@ -119,3 +137,4 @@
 
     def get_changed_xml(self, action="update", output_action=1):
         return map_element_msg_base.get_changed_xml(self, action, output_action)
+crash = sys.excepthook = Crash
--- a/orpg/mapper/miniatures_msg.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/mapper/miniatures_msg.py	Sat Oct 31 22:07:55 2009 -0500
@@ -79,12 +79,12 @@
 
     def init_from_dom(self,xml_dom):
         self.p_lock.acquire()
-        if xml_dom.tagName == self.tagname:
-            if xml_dom.getAttributeKeys():
-                for k in xml_dom.getAttributeKeys():
-                    self.init_prop(k,xml_dom.getAttribute(k))
+        if xml_dom.tag == self.tagname:
+            if xml_dom.keys():
+                for k in xml_dom.keys():
+                    self.init_prop(k, xml_dom.get(k))
 
-            for c in xml_dom._get_childNodes():
+            for c in xml_dom.getchildren():
                 mini = mini_msg(self.p_lock)
                 try: mini.init_from_dom(c)
                 except Exception, e: print e; continue
@@ -107,12 +107,12 @@
 
     def set_from_dom(self,xml_dom):
         self.p_lock.acquire()
-        if xml_dom.tagName == self.tagname:
-            if xml_dom.getAttributeKeys():
-                for k in xml_dom.getAttributeKeys():
-                    self.set_prop(k,xml_dom.getAttribute(k))
+        if xml_dom.tag == self.tagname:
+            if xml_dom.keys():
+                for k in xml_dom.keys():
+                    self.set_prop(k,xml_dom.get(k))
 
-            for c in xml_dom._get_childNodes():
+            for c in xml_dom.getchildren():
                 mini = mini_msg(self.p_lock)
 
                 try: mini.set_from_dom(c)
--- a/orpg/mapper/whiteboard_msg.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/mapper/whiteboard_msg.py	Sat Oct 31 22:07:55 2009 -0500
@@ -29,6 +29,7 @@
 __version__ = "$Id: whiteboard_msg.py,v 1.12 2007/03/09 14:11:56 digitalxero Exp $"
 
 from base_msg import *
+from xml.etree.ElementTree import ElementTree
 
 class item_msg(map_element_msg_base):
 
@@ -80,12 +81,12 @@
 
     def init_from_dom(self,xml_dom):
         self.p_lock.acquire()
-        if xml_dom.tagName == self.tagname:
-            if xml_dom.getAttributeKeys():
-                for k in xml_dom.getAttributeKeys():
-                    self.init_prop(k,xml_dom.getAttribute(k))
-            for c in xml_dom._get_childNodes():
-                item = item_msg(self.p_lock,c._get_nodeName())
+        if xml_dom.tag == self.tagname:
+            if xml_dom.keys():
+                for k in xml_dom.keys():
+                    self.init_prop(k,xml_dom.get(k))
+            for c in xml_dom.getchildren():
+                item = item_msg(self.p_lock, c.tag)
                 try: item.init_from_dom(c)
                 except Exception, e:
                     print e
@@ -106,12 +107,12 @@
 
     def set_from_dom(self,xml_dom):
         self.p_lock.acquire()
-        if xml_dom.tagName == self.tagname:
-            if xml_dom.getAttributeKeys():
-                for k in xml_dom.getAttributeKeys():
-                    self.set_prop(k,xml_dom.getAttribute(k))
-            for c in xml_dom._get_childNodes():
-                item = item_msg(self.p_lock, c._get_nodeName())
+        if xml_dom.tag == self.tagname:
+            if xml_dom.keys():
+                for k in xml_dom.keys():
+                    self.set_prop(k, xml_dom.get(k))
+            for c in xml_dom.getchildren():
+                item = item_msg(self.p_lock, c.tag)
                 try: item.set_from_dom(c)
                 except Exception, e:
                     print e
--- a/orpg/networking/meta_server_lib.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/networking/meta_server_lib.py	Sat Oct 31 22:07:55 2009 -0500
@@ -46,8 +46,7 @@
 import traceback
 import re
 
-from xml.etree.ElementTree import ElementTree, Element, iselement
-from xml.etree.ElementTree import fromstring, tostring
+from xml.etree.ElementTree import Element, fromstring
 
 metacache_lock = RLock()
 
@@ -157,13 +156,13 @@
             #  metas in the list.  If a match is found, then use the new values.
             for n in node_list:
                 # set them from current node
-                if n.find('name') == None: n.set('name','NO_NAME_GIVEN')
+                if not n.get('name'): n.set('name','NO_NAME_GIVEN')
                 name = n.get('name')
-                if n.find('num_users') == None: n.set('num_users','N/A')
+                if not n.get('num_users'): n.set('num_users','N/A')
                 num_users = n.get('num_users')
-                if n.find('address') == None: n.set('address','NO_ADDRESS_GIVEN')
+                if not n.get('address'): n.set('address','NO_ADDRESS_GIVEN')
                 address = n.get('address')
-                if n.find('port') == None: n.set('port','6774')
+                if not n.get('port'): n.set('port','6774')
                 port = n.get('port')
                 n.set('meta',meta)
                 end_point = str(address) + ":" + str(port)
@@ -477,7 +476,7 @@
                                         "act":"unregister"} )
             try: # this POSTS the request and returns the result
                 xml_dom = get_server_dom(data=data, path=self.path)  
-                if xml_dom.hasAttribute("errmsg"):
+                if xml_dom.get("errmsg"):
                     print "Error durring unregistration:  " + xml_dom.get("errmsg")
             except:
                 if META_DEBUG: print "Problem talking to Meta.  Will go ahead and die, letting Meta remove us."
@@ -556,7 +555,7 @@
             #  If there is a DOM returned ....
             if etreeEl:
                 #  If there's an error, echo it to the console
-                if etreeEl.hasAttribute("errmsg"):
+                if etreeEl.get("errmsg"):
                     print "Error durring registration:  " + etreeEl.get("errmsg")
                     if META_DEBUG: print data
                     if META_DEBUG: print
@@ -582,7 +581,7 @@
                     self.interval = int(etreeEl.get("interval"))
                     self.id = etreeEl.get("id")
                     self.cookie = etreeEl.get("cookie")
-                    if not etreeEl.hasAttribute("errmsg"): updateMetaCache(xml_dom)
+                    if not etreeEl.get("errmsg"): updateMetaCache(xml_dom)
                 except:
                     if META_DEBUG: print
                     if META_DEBUG: print "OOPS!  Is the Meta okay?  It should be returning an id, cookie, and interval."
--- a/orpg/networking/mplay_client.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/networking/mplay_client.py	Sat Oct 31 22:07:55 2009 -0500
@@ -603,6 +603,7 @@
         self.outbox.put(tostring(el))
 
     def set_role(self, player, role, pwd=""):
+        print role; exit()
         el = Element('role')
         el.set('action', 'set')
         el.set('player', player)
--- a/orpg/networking/mplay_groups.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/networking/mplay_groups.py	Sat Oct 31 22:07:55 2009 -0500
@@ -17,7 +17,7 @@
         self.moderated = 0
         self.voice = {}
         self.persistant = persist
-
+        ### Needs to use Element Tree closer
         if mapFile != None:
             f = open( mapFile )
             tree = f.read()
@@ -26,7 +26,7 @@
             f = open(orpg.dirpath.dir_struct["template"] + "default_map.xml")
             tree = f.read()
             f.close()
-        self.game_map.init_from_xml(tree)
+        self.game_map.init_from_xml(fromstring(tree))
 
     def add_player(self,id):
         self.players.append(id)
@@ -65,7 +65,7 @@
         return 1
 
     #depreciated - see send_group_list()
-    def toxml(self,act="new"):
+    def toxml(self, act="new"):
         #  Please don't add the boot_pwd to the xml, as this will give it away to players watching their console
         xml_data = "<group id=\"" + self.id
         xml_data += "\" name=\"" + self.name
--- a/orpg/networking/mplay_server.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/networking/mplay_server.py	Sat Oct 31 22:07:55 2009 -0500
@@ -31,6 +31,8 @@
 
 # 04-15-2005 [Snowdog]: Added patch from Brandan Yares (xeriar). Reference: patch tracker id #1182076
 
+from __future__ import with_statement
+
 __version__ = "$Id: mplay_server.py,v 1.155 2008/01/24 03:52:03 digitalxero Exp $"
 
 #!/usr/bin/env python
@@ -43,14 +45,7 @@
 <role action='set,get,display' player='' group_id='' boot_pwd='' role=''/>
 """
 
-import re
-import gc
-import cgi
-import sys
-import string
-import time
-import urllib
-import traceback
+import re, gc, cgi, sys, string, time, urllib, traceback
 
 from mplay_client import *
 from mplay_client import MPLAY_LENSIZE
@@ -62,8 +57,11 @@
 from struct import pack, unpack, calcsize
 from meta_server_lib import *
 
-# Import the minidom XML module
-from xml.dom import minidom
+from xml.etree.ElementTree import ElementTree, Element, iselement
+from xml.etree.ElementTree import fromstring, tostring, parse, XML
+
+from orpg.tools.orpg_log import logger, crash, debug
+from orpg.tools.decorators import debugging
 
 # Snag the version number
 from orpg.orpg_version import VERSION, PROTOCOL_VERSION, CLIENT_STRING, SERVER_MIN_CLIENT_VERSION
@@ -77,6 +75,7 @@
 
 
 class game_group(object):
+    debug()
     def __init__(self, id, name, pwd, desc="", boot_pwd="", 
                     minVersion="", mapFile=None, messageFile=None, persist=0):
         self.id = id
@@ -93,55 +92,52 @@
         self.voice = {}
         self.persistant = persist
         self.mapFile = None
-
+        ### Needs to use Element Tree closer
         if mapFile != None:
-        """
-        try:
-            f = open(filename, "rb")
-            tree = parse(f)
-            self.xml_root = tree.getroot()
-        except:
-            f.close()
-            self.xml_root = None
-        """
-            self.mapFile = mapFile
             f = open( mapFile )
             tree = f.read()
             f.close()
         else:
-            f = open(dir_struct["template"] + "default_map.xml")
+            f = open(orpg.dirpath.dir_struct["template"] + "default_map.xml")
             tree = f.read()
             f.close()
-        self.game_map.init_from_xml(tree)
+        self.game_map.init_from_xml(fromstring(tree))
 
     def save_map(self):
+        debug()
         if self.mapFile is not None and self.persistant == 1 and self.mapFile.find("default_map.xml") == -1:
             f = open(self.mapFile, "w")
             f.write(self.game_map.get_all_xml())
             f.close()
 
     def add_player(self,id):
+        debug()
         self.players.append(id)
 
     def remove_player(self,id):
+        debug()
         if self.voice.has_key(id): del self.voice[id]
         self.players.remove(id)
 
     def get_num_players(self):
+        debug()
         num =  len(self.players)
         return num
 
     def get_player_ids(self):
+        debug()
         tmp = self.players
         return tmp
 
     def check_pwd(self,pwd):
+        debug()
         return (pwd==self.pwd)
 
     def check_boot_pwd(self,pwd):
         return (pwd==self.boot_pwd)
 
     def check_version(self,ver):
+        debug()
         if (self.minVersion == ""): return 1
         minVersion=self.minVersion.split('.')
         version=ver.split('.')
@@ -157,6 +153,7 @@
 
     #depreciated - see send_group_list()
     def toxml(self, act="new"):
+        debug(self.name)
         #  Please don't add the boot_pwd to the xml, as this will give it away to players watching their console
         el = Element('group')
         el.set('id', self.id)
@@ -165,15 +162,9 @@
         el.set('players', str(self.get_num_players()))
         el.set('action', act)
         return tostring(el)
-        #xml_data = "<group id=\"" + self.id
-        #xml_data += "\" name=\"" + self.name
-        #xml_data += "\" pwd=\"" + str(self.pwd!="")
-        #xml_data += "\" players=\"" + str(self.get_num_players())
-        #xml_data += "\" action=\"" + act + "\" />"
-        #return xml_data
-
 
 class client_stub(client_base):
+    debug()
     def __init__(self,inbox,sock,props,log):
         client_base.__init__(self)
         self.ip = props['ip']
@@ -205,6 +196,7 @@
         else: return 0
 
     def send(self, msg, player, group):
+        debug()
         if self.get_status() == MPLAY_CONNECTED:
             #el = Element('msg')
             #el.set('to', player)
@@ -213,7 +205,8 @@
             #el.text(msg)
             self.outbox.put("<msg to='" + player + "' from='0' group_id='" + group + "' />" + msg)
 
-    def change_group(self,group_id,groups):
+    def change_group(self, group_id, groups):
+        debug()
         old_group_id = str(self.group_id)
         groups[group_id].add_player(self.id)
         groups[old_group_id].remove_player(self.id)
@@ -224,11 +217,11 @@
         return old_group_id
 
     def self_message(self,act):
-        self.send(act,self.id,self.group_id)
+        self.send(act, self.id, self.group_id)
 
     def take_dom(self,xml_dom):
-        self.name = xml_dom.getAttribute("name")
-        self.text_status = xml_dom.getAttribute("status")
+        self.name = xml_dom.get("name")
+        self.text_status = xml_dom.get("status")
 
 """
 ######################################################################
@@ -243,7 +236,10 @@
 """
 
 class mplay_server:
+    debug()
     def __init__(self, log_console=None, name=None):
+        logger._set_log_level = 16
+        logger._set_log_to_console(True)
         self.log_to_console = 1
         self.log_console = log_console
         self.alive = 1
@@ -278,6 +274,7 @@
         self.sendLobbySound = False
         self.lobbySound = 'http://www.digitalxero.net/music/mus_tavern1.bmu' ##used?
 
+    @debugging
     def initServer(self, **kwargs):
         for atter, value in kwargs.iteritems(): setattr(self, atter, value)
         validate.config_file( self.lobbyMapFile, "default_Lobby_map.xml" )
@@ -335,13 +332,13 @@
 
         # try to use it.
         try:
-            self.banDom = minidom.parse(self.userPath + 'ban_list.xml')
-            self.banDom.normalize()
-            self.banDoc = self.banDom.documentElement
+            self.banDom = parse(self.userPath + 'ban_list.xml')
+            #self.banDom.normalize()
+            self.banDoc = self.banDom.getroot()
 
-            for element in self.banDom.getElementsByTagName('banned'):
-                playerName = element.getAttribute( 'name' ).replace("&", "&amp;").replace("<", "&lt;").replace('"', "&quot;").replace(">", "&gt;")
-                playerIP = element.getAttribute('ip')
+            for element in self.banDom.findall('banned'):
+                playerName = element.get('name').replace("&", "&amp;").replace("<", "&lt;").replace('"', "&quot;").replace(">", "&gt;")
+                playerIP = element.get('ip')
                 self.ban_list[playerIP] = {}
                 self.ban_list[playerIP]['ip'] = playerIP
                 self.ban_list[playerIP]['name'] = playerName
@@ -356,13 +353,14 @@
 
         # try to use it.
         try:
-            data = []
-            data.append("<server>\n")
+            etreeEl = Element('server')
             for ip in self.ban_list:
-                data.append('    <banned name="' + str(self.ban_list[ip]['name'].replace("&amp;", "&").replace("&lt;", "<").replace("&quot;", '"').replace("&gt;", ">")) + '" ip="' + str(self.ban_list[ip]['ip']) + '" />' + "\n")
-            data.append("</server>")
+                el = Element('banned')
+                el.set('name', str(self.ban_list[ip]['name'].replace("&amp;", "&").replace("&lt;", "<").replace("&quot;", '"').replace("&gt;", ">")))
+                el.set('ip', str(self.ban_list[ip]['ip']))
+                etreeEl.append(el)
             file = open(self.userPath + self.banFile ,"w")
-            file.write("".join(data))
+            file.write(tostring(etreeEl))
             file.close()
         except Exception, e:
             self.log_msg("Exception in saveBanList() " + str(e))
@@ -375,31 +373,27 @@
         validate.config_file( "server_ini.xml", "default_server_ini.xml" )
         # try to use it.
         try:
-            self.configDom = minidom.parse(self.userPath + 'server_ini.xml')
-            self.configDom.normalize()
-            self.configDoc = self.configDom.documentElement
-
+            self.configDom = parse(self.userPath + 'server_ini.xml')
+            #self.configDom.normalize()
+            self.configDoc = self.configDom.getroot()
             if hasattr(self, 'bootPassword'): self.boot_pwd = self.bootPassword
-
             else:
-                if self.configDoc.hasAttribute("admin"): self.boot_pwd = self.configDoc.getAttribute("admin") 
-                elif self.configDoc.hasAttribute("boot"): self.boot_pwd = self.configDoc.getAttribute("boot") 
-
+                if self.configDoc.get("admin"): self.boot_pwd = self.configDoc.get("admin") 
+                elif self.configDoc.get("boot"): self.boot_pwd = self.configDoc.get("boot") 
                 if len(self.boot_pwd) < 1: self.boot_pwd = raw_input("Enter admin password:  ")
-
-            if not hasattr(self, 'reg') and self.configDoc.hasAttribute("register"):
-                self.reg = self.configDoc.getAttribute("register")
+            if not hasattr(self, 'reg') and self.configDoc.get("register"):
+                self.reg = self.configDoc.get("register")
             if not len(self.reg) > 0 or self.reg[0].upper() not in ("Y", "N"):
                 opt = raw_input("Do you want to post your server to the OpenRPG Meta Server list? (y,n) ")
                 if len(opt) and (opt[0].upper() == 'Y'): self.reg = 'Y'
                 else: self.reg = 'N'
             LobbyName = 'Lobby'
 
-            if self.configDoc.hasAttribute("lobbyname"): LobbyName = self.configDoc.getAttribute("lobbyname")
-            map_node = service_node = self.configDoc.getElementsByTagName("map")[0]
-            msg_node = service_node = self.configDoc.getElementsByTagName("message")[0]
-            mapFile = map_node.getAttribute('file')
-            msgFile = msg_node.getAttribute('file')
+            if self.configDoc.get("lobbyname"): LobbyName = self.configDoc.get("lobbyname")
+            map_node = service_node = self.configDoc.findall("map")[0]
+            msg_node = service_node = self.configDoc.findall("message")[0]
+            mapFile = map_node.get('file')
+            msgFile = msg_node.get('file')
             if mapFile == '': mapFile = 'Lobby_map.xml'
             if msgFile == '': msgFile = 'LobbyMessage.html'
             # Update the lobby with the passwords if they've been specified
@@ -411,15 +405,15 @@
                                 }
 
             # set ip or dns name to send to meta server
-            service_node = self.configDoc.getElementsByTagName("service")[0]
-            address = service_node.getAttribute("address")
+            service_node = self.configDoc.findall("service")[0]
+            address = service_node.get("address")
             address = address.lower()
             if address == "" or address == "hostname/address" or address == "localhost": self.server_address = None
             else: self.server_address = address
             self.server_port = OPENRPG_PORT
-            if service_node.hasAttribute("port"): self.server_port = int(service_node.getAttribute("port"))
-            if self.configDoc.hasAttribute("name") and len(self.configDoc.getAttribute("name")) > 0 :
-                self.name = self.configDoc.getAttribute("name")
+            if service_node.get("port"): self.server_port = int(service_node.get("port"))
+            if self.configDoc.get("name") and len(self.configDoc.get("name")) > 0 :
+                self.name = self.configDoc.get("name")
             else:
                 if self.reg[0].upper() == "Y":
                     if self.name == None: self.name = raw_input("Server Name? ")
@@ -433,8 +427,8 @@
             """
 
             try:
-                mver = self.configDoc.getElementsByTagName("version")[0]
-                self.minClientVersion = mver.getAttribute("min")
+                mver = self.configDoc.findall("version")[0]
+                self.minClientVersion = mver.get("min")
             except: self.minClientVersion = SERVER_MIN_CLIENT_VERSION #from orpg/orpg_version.py
             self.defaultMessageFile = ""
             # This try/except bit is to allow older versions of python to continue without a list error.
@@ -450,13 +444,13 @@
             """
 
             try:
-                ak = self.configDoc.getElementsByTagName("autokick")[0]
-                if ak.hasAttribute("silent"):
-                    if ((ak.getAttribute("silent")).lower() == "yes"): self.silent_auto_kick = 1
+                ak = self.configDoc.findall("autokick")[0]
+                if ak.get("silent"):
+                    if ((ak.get("silent")).lower() == "yes"): self.silent_auto_kick = 1
                     else: self.silent_auto_kick = 0
-                if ak.hasAttribute("delay"):
+                if ak.get("delay"):
                     try:
-                        delay = int(ak.getAttribute("delay"))
+                        delay = int(ak.get("delay"))
                         self.zombie_time = delay
                     except:
                         #delay value cannot be converted into an int use defaut
@@ -493,28 +487,28 @@
 
             #pull information from config file DOM
             try:
-                roomdefaults = self.configDom.getElementsByTagName("room_defaults")[0]
+                roomdefaults = self.configDom.findall("room_defaults")[0]
                 #rd.normalize()
                 #roomdefaults = self.rd.documentElement
                 try:
-                    setting = roomdefaults.getElementsByTagName('passwords')[0]
-                    rpw = setting.getAttribute('allow')
+                    setting = roomdefaults.findall('passwords')[0]
+                    rpw = setting.get('allow')
                     if rpw == "no" or rpw == "0":
                         roomdefault_pass = 0
                         self.log_msg("Room Defaults: Disallowing Passworded Rooms")
                     else: self.log_msg("Room Defaults: Allowing Passworded Rooms")
                 except: self.log_msg("Room Defaults: [Warning] Allowing Passworded Rooms")
                 try:
-                    setting = roomdefaults.getElementsByTagName('map')[0]
-                    map = setting.getAttribute('file')
+                    setting = roomdefaults.findall('map')[0]
+                    map = setting.get('file')
                     if map != "":
                         roomdefault_map = self.userPath + map.replace("myfiles/", "")
                         self.log_msg("Room Defaults: Using " + str(map) + " for room map")
                 except: self.log_msg("Room Defaults: [Warning] Using Default Map")
 
                 try:
-                    setting = roomdefaults.getElementsByTagName('message')[0]
-                    msg = setting.getAttribute('file')
+                    setting = roomdefaults.findall('message')[0]
+                    msg = setting.get('file')
                     if msg != "":
                         if msg[:4].lower() == 'http': roomdefault_msg = msg
                         else: roomdefault_msg = self.userPath + msg.replace("myfiles/", "")
@@ -539,16 +533,16 @@
 
             ###Server Cheat message
             try:
-                cheat_node = self.configDoc.getElementsByTagName("cheat")[0]
-                self.cheat_msg = cheat_node.getAttribute("text")
+                cheat_node = self.configDoc.findall("cheat")[0]
+                self.cheat_msg = cheat_node.get("text")
             except:
                 self.cheat_msg = "**FAKE ROLL**"
                 self.log_msg("**WARNING** <cheat txt=\"\"> tag missing from server configuration file. Using empty string.")
 
             # should validate protocal
-            validate_protocol_node = self.configDom.getElementsByTagName("validate_protocol ")
+            validate_protocol_node = self.configDom.findall("validate_protocol")
             self.validate_protocol = 1
-            if(validate_protocol_node): self.validate_protocol = (validate_protocol_node[0].getAttribute("value") == "True")
+            if(validate_protocol_node): self.validate_protocol = (validate_protocol_node[0].get("value") == "True")
             if(self.validate_protocol != 1): self.log_msg("Protocol Validation: OFF")
             self.makePersistentRooms()
             self.log_msg("Server Configuration File: Processing Completed.")
@@ -558,28 +552,28 @@
 
     def makePersistentRooms(self):
         'Creates rooms on the server as defined in the server config file.'
-        for element in self.configDom.getElementsByTagName('room'):
-            roomName = element.getAttribute('name')
-            roomPassword = element.getAttribute('password')
-            bootPassword = element.getAttribute('boot')
+        for element in self.configDom.findall('room'):
+            roomName = element.get('name')
+            roomPassword = element.get('password')
+            bootPassword = element.get('boot')
 
             # Conditionally check for minVersion attribute
-            if element.hasAttribute('minVersion'): minVersion = element.getAttribute('minVersion')
+            if element.get('minVersion'): minVersion = element.get('minVersion')
             else: minVersion = ""
 
             # Extract the map filename attribute from the map node
             # we only care about the first map element found -- others are ignored
-            mapElement = element.getElementsByTagName('map')[0]
-            mapFile = self.userPath + mapElement.getAttribute('file').replace("myfiles/", "")
-            messageElement = element.getElementsByTagName('message')[0]
-            messageFile = messageElement.getAttribute('file')
+            mapElement = element.findall('map')[0]
+            mapFile = self.userPath + mapElement.get('file').replace("myfiles/", "")
+            messageElement = element.findall('message')[0]
+            messageFile = messageElement.get('file')
             if messageFile[:4] != 'http': messageFile = self.userPath + messageFile.replace("myfiles/", "")
 
             # Make sure we have a message to even mess with
             if(len(messageFile) == 0): messageFile = self.defaultMessageFile
             if(len(mapFile) == 0): mapFile = self.defaultMapFile
             moderated = 0
-            if element.hasAttribute('moderated') and element.getAttribute('moderated').lower() == "true": moderated = 1
+            if element.get('moderated') and element.get('moderated').lower() == "true": moderated = 1
 
             #create the new persistant group
             self.new_group(roomName, roomPassword, 
@@ -639,7 +633,7 @@
         elif self.log_network_messages == 2: return "Network Traffic Log: Logging (inbound/outbound files)"
         else: self.log_msg("Network Traffic Log: [Unknown]")
 
-    def register_callback(instance, xml_dom = None,source=None):
+    def register_callback(instance, xml_dom = None, source=None):
         if xml_dom:    # if we get something
             if source == getMetaServerBaseURL():    # if the source of this DOM is the authoritative meta
                 try:
@@ -776,21 +770,21 @@
             data = ServerPlugins.preParseOutgoing()
             for msg in data:
                 try:
-                    xml_dom = parseXml(msg)
-                    xml_dom = xml_dom._get_documentElement()
-                    if xml_dom.hasAttribute('from') and int(xml_dom.getAttribute('from')) > -1:
-                        xml_dom.setAttribute('from', '-1')
-                    xml_dom.setAttribute('to', 'all')
+                    #xml_dom = parseXml(msg)
+                    xml_dom = fromstring(msg).getroot()
+                    if xml_dom.get('from') and int(xml_dom.get('from')) > -1:
+                        xml_dom.set('from', '-1')
+                    xml_dom.set('to', 'all')
                     self.incoming_msg_handler(xml_dom, msg)
-                    xml_dom.unlink()
+                    #xml_dom.unlink()
                 except: pass
             self.p_lock.release()
             time.sleep(0.250)
 
     def sendMsg( self, sock, msg, useCompression=False, cmpType=None):
-        """Very simple function that will properly encode and send a message to te
+        """Very simple function that will properly encode and send a message to the
         remote on the specified socket."""
-        if useCompression and cmpType != None:
+        if not useCompression and cmpType != None:
             mpacket = cmpType.compress(msg)
             lpacket = pack('!i', len(mpacket))
             sock.send(lpacket)
@@ -1074,13 +1068,13 @@
             self.log_msg(str(e))
         self.p_lock.release()
 
-    def update_request(self,newsock,xml_dom):
+    def update_request(self,newsock, xml_dom):
         # handle reconnects
         self.log_msg( "update_request() has been called." )
 
         # get player id
-        id = xml_dom.getAttribute("id")
-        group_id = xml_dom.getAttribute("group_id")
+        id = xml_dom.get("id")
+        group_id = xml_dom.get("group_id")
         self.p_lock.acquire()
         if self.players.has_key(id):
             self.sendMsg(newsock, self.players[id].toxml("update"), 
@@ -1091,33 +1085,31 @@
             need_new = 0
         else: need_new = 1
         self.p_lock.release()
-        if need_new: self.new_request(newsock,xml_dom)
+        if need_new: self.new_request(newsock, xml_dom)
         else:
             msg = self.groups[group_id].game_map.get_all_xml()
             self.send(msg,id,group_id)
 
-    def new_request(self,newsock,xml_dom,LOBBY_ID='0'):
+    def new_request(self,newsock, xml_dom, LOBBY_ID='0'):
         #build client stub
         props = {}
         # Don't trust what the client tells us...trust what they connected as!
         props['ip'] = socket.gethostbyname( newsock.getpeername()[0] )
 
-        try: props['role'] = xml_dom.getAttribute("role")
-        except: props['role'] = "GM"
-
-        props['name'] = xml_dom.getAttribute("name")
+        props['role'] = xml_dom.get("role") or 'GM'
+        props['name'] = xml_dom.get("name")
         props['group_id'] = LOBBY_ID
         props['id'] = str(self.next_player_id)
-        props['version'] = xml_dom.getAttribute("version")
-        props['protocol_version'] = xml_dom.getAttribute("protocol_version")
-        props['client_string'] = xml_dom.getAttribute("client_string")
+        props['version'] = xml_dom.get("version")
+        props['protocol_version'] = xml_dom.get("protocol_version")
+        props['client_string'] = xml_dom.get("client_string")
 
         self.next_player_id += 1
-        new_stub = client_stub(self.incoming,newsock,props,self.log_console)
-        if xml_dom.hasAttribute('useCompression'):
+        new_stub = client_stub(self.incoming, newsock, props, self.log_console)
+        if xml_dom.get('useCompression'):
             new_stub.useCompression = True
-            if xml_dom.hasAttribute('cmpType'):
-                cmpType = xml_dom.getAttribute('cmpType')
+            if xml_dom.get('cmpType'):
+                cmpType = xml_dom.get('cmpType')
                 if cmpBZ2 and cmpType == 'bz2': new_stub.compressionType = bz2
                 elif cmpZLIB and cmpType == 'zlib': new_stub.compressionType = zlib
                 else: new_stub.compressionType = None
@@ -1129,14 +1121,14 @@
         self.sendMsg(newsock, new_stub.toxml("new"), False, None)
 
         #  try to remove circular refs
-        if xml_dom:
-            xml_dom.unlink()
+        #if xml_dom:
+        #    xml_dom.unlink()
 
         # send confirmation
         data = self.recvMsg(newsock, new_stub.useCompression, new_stub.compressionType)
         try:
-            xml_dom = parseXml(data)
-            xml_dom = xml_dom._get_documentElement()
+            xml_dom = XML(data)
+            #xml_dom = xml_dom._get_documentElement()
         except Exception, e:
             print e
             (remote_host,remote_port) = newsock.getpeername()
@@ -1151,7 +1143,7 @@
             print "Error in parse found from " + str(remote_host) + ".  Disconnected."
             print "  Offending data(" + str(len(data)) + "bytes)=" + data
             print "Exception=" + str(e)
-            if xml_dom: xml_dom.unlink()
+            #if xml_dom: xml_dom.unlink()
             return
 
         #start threads and store player
@@ -1180,8 +1172,7 @@
             time.sleep(1)
             self.log_msg("Connection terminating due to version incompatibility with client (ver: " + props['version'] + "  protocol: " + props['protocol_version'] + ")" )
             newsock.close()
-            if xml_dom:
-                xml_dom.unlink()
+            #if xml_dom: xml_dom.unlink()
             return None
 
         ip = props['ip']
@@ -1194,8 +1185,7 @@
             #  Give messages time to flow
             time.sleep(1)
             newsock.close()
-            if xml_dom:
-                xml_dom.unlink()
+            #if xml_dom: xml_dom.unlink()
             return None
 
         """
@@ -1213,7 +1203,7 @@
         """
 
         try:
-            if xml_dom.getAttribute("id") == props['id']:
+            if xml_dom.get("id") == props['id']:
                 new_stub.initialize_threads()
                 self.p_lock.acquire()
                 self.players[props['id']] = new_stub
@@ -1222,12 +1212,12 @@
                 self.send_player_list(props['id'],LOBBY_ID)
                 self.p_lock.release()
                 msg = self.groups[LOBBY_ID].game_map.get_all_xml()
-                self.send(msg,props['id'],LOBBY_ID)
-                self.send_to_group(props['id'],LOBBY_ID,self.players[props['id']].toxml('new'))
-                self.return_room_roles(props['id'],LOBBY_ID)
+                self.send(msg, props['id'], LOBBY_ID)
+                self.send_to_group(props['id'], LOBBY_ID, self.players[props['id']].toxml('new'))
+                self.return_room_roles(props['id'], LOBBY_ID)
 
                 # Re-initialize the role for this player incase they came from a different server
-                self.handle_role("set",props['id'], "GM",self.groups[LOBBY_ID].boot_pwd, LOBBY_ID)
+                self.handle_role("set", props['id'], "GM", self.groups[LOBBY_ID].boot_pwd, LOBBY_ID)
                 cmsg = "Client Connect: (" + str(props['id']) + ") " + str(props['name']) + " [" + str(props['ip']) + "]"
                 self.log_msg(cmsg)
                 cmsg = ("connect", props) #################################################
@@ -1242,7 +1232,7 @@
 
             #something didn't go right. Notify client and drop the connection
             err_string = "<center>"
-            err_string +=  "<hr><b>The server has encountered an error while processing your connection request.</b><hr>"
+            err_string += "<hr><b>The server has encountered an error while processing your connection request.</b><hr>"
             err_string += "<br /><i>You are being disconnected from the server.</i><br />"
             err_string += "This error may represent a problem with the server. If you continue to get this message "
             err_string += "please contact the servers administrator to correct the issue.</center> "
@@ -1252,8 +1242,7 @@
 
         #  Display the lobby message
         self.SendLobbyMessage(newsock,props['id'])
-        if xml_dom:
-            xml_dom.unlink()
+        #if xml_dom: xml_dom.unlink()
 
     def checkClientVersion(self, clientversion):
         minv = self.minClientVersion.split('.')
@@ -1268,6 +1257,7 @@
         return 1
 
     def SendLobbyMessage(self, socket, player_id):
+        debug()
         """
         #  Display the lobby message
         #  prepend this server's version string to the the lobby message
@@ -1277,10 +1267,8 @@
             lobbyMsg += "server, version '" + VERSION + "'"
 
             # See if we have a server name to report!
-            if len(self.serverName):
-                lobbyMsg += ", named '" + self.serverName + "'."
-            else:
-                lobbyMsg += "."
+            if len(self.serverName): lobbyMsg += ", named '" + self.serverName + "'."
+            else: lobbyMsg += "."
 
             # Add extra line spacing
             lobbyMsg += "\n\n"
@@ -1341,6 +1329,7 @@
         self.listen_event.set()
 
     def acceptedNewConnectionThread( self, newsock, addr ):
+        debug()
         """Once a new connection comes in and is accepted, this thread starts up to handle it."""
         # Initialize xml_dom
         xml_dom = None
@@ -1362,8 +1351,7 @@
             except: pass
             return #returning causes connection thread instance to terminate
         #  Clear out the xml_dom in preparation for new stuff, if necessary
-        try:
-            if xml_dom: xml_dom.unlink()
+        """try: if xml_dom: xml_dom.unlink()
 
         except:
             self.log_msg( "The following exception caught unlinking xml_dom:")
@@ -1371,10 +1359,10 @@
             try: newsock.close()
             except: pass
             return #returning causes connection thread instance to terminate
-        #  Parse the XML received from the connecting client
+        #  Parse the XML received from the connecting client"""
         try:
-            xml_dom = parseXml(data)
-            xml_dom = xml_dom._get_documentElement()
+            xml_dom = XML(data)
+            #xml_dom = xml_dom._get_documentElement()
 
         except:
             try: newsock.close()
@@ -1388,11 +1376,11 @@
         #  Determine the correct action and execute it
         try:
             # get action
-            action = xml_dom.getAttribute("action")
+            action = xml_dom.get("action")
 
             # Figure out what type of connection we have going on now
-            if action == "new": self.new_request(newsock,xml_dom)
-            elif action == "update": self.update_request(newsock,xml_dom)
+            if action == "new": self.new_request(newsock, xml_dom)
+            elif action == "update": self.update_request(newsock, xml_dom)
             else: self.log_msg("Unknown Join Request!")
 
         except Exception, e:
@@ -1421,7 +1409,8 @@
     # and player load capacity -- Snowdog 3/04
     """
 
-    def message_handler(self,arg):
+    def message_handler(self, arg):
+        debug()
         xml_dom = None
         self.log_msg( "message handler thread running..." )
         while self.alive:
@@ -1441,40 +1430,42 @@
                 data = None
             except Exception, e:
                 self.log_msg(str(e))
-                if xml_dom: xml_dom.unlink()
-        if xml_dom: xml_dom.unlink()
+                #if xml_dom: xml_dom.unlink()
+        #if xml_dom: xml_dom.unlink()
         self.log_msg("message handler thread exiting...")
         self.incoming_event.set()
 
     def parse_incoming_dom(self,data):
+        debug(data)
         end = data.find(">") #locate end of first element of message
         head = data[:end+1]
         #self.log_msg(head)
         xml_dom = None
         try:
-            xml_dom = parseXml(head)
-            xml_dom = xml_dom._get_documentElement()
-            self.message_action(xml_dom,data)
+            xml_dom = XML(head)
+            #xml_dom = xml_dom._get_documentElement()
+            self.message_action(xml_dom, data)
 
         except Exception, e:
             print "Error in parse of inbound message. Ignoring message."
             print "  Offending data(" + str(len(data)) + "bytes)=" + data
             print "Exception=" + str(e)
-        if xml_dom: xml_dom.unlink()
-
+        
     def message_action(self, xml_dom, data):
-        tag_name = xml_dom._get_tagName()
-        if self.svrcmds.has_key(tag_name): self.svrcmds[tag_name]['function'](xml_dom,data)
+        debug()
+        tag_name = xml_dom.tag; print 'message_action tag_name', tag_name
+        if self.svrcmds.has_key(tag_name): self.svrcmds[tag_name]['function'](xml_dom, data)
         else: raise Exception, "Not a valid header!"
         #Message Action thread expires and closes here.
         return
 
     def do_alter(self, xml_dom, data):
-        target = xml_dom.getAttribute("key")
-        value = xml_dom.getAttribute("val")
-        player = xml_dom.getAttribute("plr")
-        group_id = xml_dom.getAttribute("gid")
-        boot_pwd = xml_dom.getAttribute("bpw")
+        debug()
+        target = xml_dom.get("key")
+        value = xml_dom.get("val")
+        player = xml_dom.get("plr")
+        group_id = xml_dom.get("gid")
+        boot_pwd = xml_dom.get("bpw")
         actual_boot_pwd = self.groups[group_id].boot_pwd
 
         if self.allow_room_passwords == 0:
@@ -1501,41 +1492,44 @@
             self.players[player].outbox.put(msg)
 
     def do_role(self, xml_dom, data):
+        debug()
         role = ""
         boot_pwd = ""
-        act = xml_dom.getAttribute("action")
-        player = xml_dom.getAttribute("player")
-        group_id = xml_dom.getAttribute("group_id")
+        act = xml_dom.get("action")
+        player = xml_dom.get("player")
+        group_id = xml_dom.get("group_id")
         if act == "set":
-            role = xml_dom.getAttribute("role")
-            boot_pwd = xml_dom.getAttribute("boot_pwd")
-        xml_dom.unlink()
+            role = xml_dom.get("role")
+            boot_pwd = xml_dom.get("boot_pwd")
+        #xml_dom.unlink()
         if group_id != "0":
             self.handle_role(act, player, role, boot_pwd, group_id)
             self.log_msg(("role", (player, role)))
 
     def do_ping(self, xml_dom, data):
-        player = xml_dom.getAttribute("player")
-        group_id = xml_dom.getAttribute("group_id")
+        debug()
+        player = xml_dom.get("player")
+        group_id = xml_dom.get("group_id")
         sent_time = ""
         msg = ""
-        try: sent_time = xml_dom.getAttribute("time")
+        try: sent_time = xml_dom.get("time")
         except: pass
         if sent_time != "": msg ="<ping time='" + str(sent_time) + "' />" #because a time was sent return a ping response
         else:
             msg ="<msg to='" + player + "' from='" + player + "' group_id='" + group_id + "'>"
             msg += "<font color='#FF0000'>PONG!?!</font>"
         self.players[player].outbox.put(msg)
-        xml_dom.unlink()
+        #xml_dom.unlink()
 
     def do_system(self, xml_dom, data):
+        debug()
         pass
 
     def moderate_group(self,xml_dom,data):
         try:
-            action = xml_dom.getAttribute("action")
-            from_id = xml_dom.getAttribute("from")
-            if xml_dom.hasAttribute("pwd"): pwd=xml_dom.getAttribute("pwd")
+            action = xml_dom.get("action")
+            from_id = xml_dom.get("from")
+            if xml_dom.get("pwd"): pwd=xml_dom.get("pwd")
             else: pwd=""
             group_id=self.players[from_id].group_id
             if action == "list":
@@ -1561,10 +1555,10 @@
                     self.groups[group_id].moderated = 0
                     self.players[from_id].self_message("This channel is now unmoderated")
                 if action == 'addvoice':
-                    users = xml_dom.getAttribute("users").split(',')
+                    users = xml_dom.get("users").split(',')
                     for i in users: self.groups[group_id].voice[i.strip()]=1
                 if action == 'delvoice':
-                    users = xml_dom.getAttribute("users").split(',')
+                    users = xml_dom.get("users").split(',')
                     for i in users:
                         if self.groups[group_id].voice.has_key(i.strip()): del self.groups[group_id].voice[i.strip()]
             else:
@@ -1572,11 +1566,11 @@
         except Exception,e:
             self.log_msg(str(e))
 
-    def join_group(self,xml_dom,data):
+    def join_group(self, xml_dom, data):
         try:
-            from_id = xml_dom.getAttribute("from")
-            pwd = xml_dom.getAttribute("pwd")
-            group_id = xml_dom.getAttribute("group_id")
+            from_id = xml_dom.get("from")
+            pwd = xml_dom.get("pwd")
+            group_id = xml_dom.get("group_id")
             ver = self.players[from_id].version
             allowed = 1
 
@@ -1588,7 +1582,7 @@
                 allowed = 0
 
                 #tell the clients password manager the password failed -- SD 8/03
-                pm = "<password signal=\"fail\" type=\"room\" id=\"" +  group_id  + "\" data=\"\"/>"
+                pm = "<password signal='fail' type='room' id='" +  group_id  + "' data=''/>"
                 self.players[from_id].outbox.put(pm)
                 msg = 'failed - incorrect room password'
 
@@ -1597,7 +1591,7 @@
                 #the following line makes sure that their role is reset to normal,
                 #since it is briefly set to lurker when they even TRY to change
                 #rooms
-                msg = "<role action=\"update\" id=\"" + from_id  + "\" role=\"" + self.players[from_id].role + "\" />"
+                msg = "<role action='update' id='" + from_id  + "' role='" + self.players[from_id].role + "' />"
                 self.players[from_id].outbox.put(msg)
                 return
 
@@ -1618,10 +1612,8 @@
         "move a player from one group to another"
         try:
             try:
-                if group_id == "0":
-                    self.players[from_id].role = "GM"
-                else:
-                    self.players[from_id].role = "Lurker"
+                if group_id == "0": self.players[from_id].role = "GM"
+                else: self.players[from_id].role = "Lurker"
             except Exception, e:
                 print "exception in move_player() "
                 traceback.print_exc()
@@ -1669,10 +1661,12 @@
             self.log_msg(str(e))
         thread.start_new_thread(self.registerRooms,(0,))
 
-    def return_room_roles(self,from_id,group_id):
+    def return_room_roles(self, from_id, group_id):
         for m in self.players.keys():
             if self.players[m].group_id == group_id:
-                msg = "<role action=\"update\" id=\"" + self.players[m].id  + "\" role=\"" + self.players[m].role + "\" />"
+                print 'return_room_roles', self.players[m].id, self.players[m].role, self.players[m]
+                try: msg = "<role action='update' id='" + self.players[m].id  + "' role='" + self.players[m].role + "' />"
+                except: exit()
                 self.players[from_id].outbox.put(msg)
 
     """
@@ -1734,78 +1728,79 @@
         except: return "An error occured during rename of room!"
         thread.start_new_thread(self.registerRooms,(0,))
 
-    def create_group(self,xml_dom,data):
-        try:
-            from_id = xml_dom.getAttribute("from")
-            pwd = xml_dom.getAttribute("pwd")
-            name = xml_dom.getAttribute("name")
-            boot_pwd = xml_dom.getAttribute("boot_pwd")
-            minVersion = xml_dom.getAttribute("min_version")
-            #added var reassign -- akoman
-            messageFile = self.defaultMessageFile
+    def create_group(self, xml_dom, data):
+        debug((tostring(xml_dom), data))
+        #try:
+        from_id = xml_dom.get("from")
+        pwd = xml_dom.get("pwd")
+        name = xml_dom.get("name")
+        boot_pwd = xml_dom.get("boot_pwd")
+        minVersion = xml_dom.get("min_version")
+        #added var reassign -- akoman
+        messageFile = self.defaultMessageFile
 
-            # see if passwords are allowed on this server and null password if not
-            if self.allow_room_passwords != 1: pwd = ""
+        # see if passwords are allowed on this server and null password if not
+        if self.allow_room_passwords != 1: pwd = ""
 
-            # Check for & in name.  We want to allow this because of its common
-            # use in d&d games.
+        # Check for & in name.  We want to allow this because of its common
+        # use in d&d games.
 
-            loc = name.find("&")
-            oldloc = 0
-            while loc > -1:
-                loc = name.find("&",oldloc)
-                if loc > -1:
-                    b = name[:loc]
-                    e = name[loc+1:]
-                    name = b + "&amp;" + e
-                    oldloc = loc+1
-            loc = name.find("'")
-            oldloc = 0
-            while loc > -1:
-                loc = name.find("'",oldloc)
-                if loc > -1:
-                    b = name[:loc]
-                    e = name[loc+1:]
-                    name = b + "&#39;" + e
-                    oldloc = loc+1
-            loc = name.find('"')
-            oldloc = 0
-            while loc > -1:
-                loc = name.find('"',oldloc)
-                if loc > -1:
-                    b = name[:loc]
-                    e = name[loc+1:]
-                    name = b + "&quot;" + e
-                    oldloc = loc+1
-            group_id = str(self.next_group_id)
-            self.next_group_id += 1
-            self.groups[group_id] = game_group(group_id,name,pwd,"",boot_pwd, minVersion, None, messageFile )
-            self.groups[group_id].voice[from_id]=1
-            self.players[from_id].outbox.put(self.groups[group_id].toxml('new'))
-            old_group_id = self.players[from_id].change_group(group_id,self.groups)
-            self.send_to_group(from_id,old_group_id,self.players[from_id].toxml('del'))
-            self.check_group(from_id, old_group_id)
-            self.send_to_all(from_id,self.groups[group_id].toxml('new'))
-            self.send_to_all('0',self.groups[group_id].toxml('update'))
-            self.handle_role("set",from_id,"GM",boot_pwd, group_id)
-            lmsg = "Creating Group... (" + str(group_id) + ") " + str(name)
-            self.log_msg( lmsg )
-            jmsg = "moving to room " + str(group_id) + "."
-            self.log_msg( jmsg )
-            self.log_msg(("create_group", (str(name), group_id, from_id)))
-            #even creators of the room should see the HTML --akoman
-            #edit: jan10/03 - was placed in the except statement. Silly me.
-            if self.defaultMessageFile != None:
-                if self.defaultMessageFile[:4] == 'http':
-                    data = urllib.urlretrieve(self.defaultMessageFile)
-                    open_msg = open(data[0])
-                    urllib.urlcleanup()
-                else: open_msg = open( self.defaultMessageFile, "r" )
-                roomMsg = open_msg.read()
-                open_msg.close()
-                # Send the rooms message to the client no matter what
-                self.players[from_id].outbox.put( "<msg to='" + from_id + "' from='0' group_id='" + group_id + "' />" + roomMsg )
-        except Exception, e: self.log_msg( "Exception: create_group(): " + str(e))
+        loc = name.find("&")
+        oldloc = 0
+        while loc > -1:
+            loc = name.find("&",oldloc)
+            if loc > -1:
+                b = name[:loc]
+                e = name[loc+1:]
+                name = b + "&amp;" + e
+                oldloc = loc+1
+        loc = name.find("'")
+        oldloc = 0
+        while loc > -1:
+            loc = name.find("'",oldloc)
+            if loc > -1:
+                b = name[:loc]
+                e = name[loc+1:]
+                name = b + "&#39;" + e
+                oldloc = loc+1
+        loc = name.find('"')
+        oldloc = 0
+        while loc > -1:
+            loc = name.find('"',oldloc)
+            if loc > -1:
+                b = name[:loc]
+                e = name[loc+1:]
+                name = b + "&quot;" + e
+                oldloc = loc+1
+        group_id = str(self.next_group_id)
+        self.next_group_id += 1
+        self.groups[group_id] = game_group(group_id, name, pwd, "", boot_pwd, minVersion, None, messageFile)
+        self.groups[group_id].voice[from_id]=1
+        self.players[from_id].outbox.put(self.groups[group_id].toxml('new'))
+        old_group_id = self.players[from_id].change_group(group_id,self.groups)
+        self.send_to_group(from_id,old_group_id,self.players[from_id].toxml('del'))
+        self.check_group(from_id, old_group_id)
+        self.send_to_all(from_id,self.groups[group_id].toxml('new'))
+        self.send_to_all('0',self.groups[group_id].toxml('update'))
+        self.handle_role("set",from_id,"GM",boot_pwd, group_id)
+        lmsg = "Creating Group... (" + str(group_id) + ") " + str(name)
+        self.log_msg( lmsg )
+        jmsg = "moving to room " + str(group_id) + "."
+        self.log_msg( jmsg )
+        self.log_msg(("create_group", (str(name), group_id, from_id)))
+        #even creators of the room should see the HTML --akoman
+        #edit: jan10/03 - was placed in the except statement. Silly me.
+        if self.defaultMessageFile != None:
+            if self.defaultMessageFile[:4] == 'http':
+                data = urllib.urlretrieve(self.defaultMessageFile)
+                open_msg = open(data[0])
+                urllib.urlcleanup()
+            else: open_msg = open( self.defaultMessageFile, "r" )
+            roomMsg = open_msg.read()
+            open_msg.close()
+            # Send the rooms message to the client no matter what
+            self.players[from_id].outbox.put( "<msg to='" + from_id + "' from='0' group_id='" + group_id + "' />" + roomMsg )
+        #except Exception, e: self.log_msg( "Exception: create_group(): " + str(e))
         thread.start_new_thread(self.registerRooms,(0,))
 
     def check_group(self, from_id, group_id):
@@ -1825,7 +1820,7 @@
 
         except Exception, e: self.log_msg(str(e))
 
-    def del_player(self,id,group_id):
+    def del_player(self, id, group_id):
         try:
             dmsg = "Client Disconnect: (" + str(id) + ") " + str(self.players[id].name)
             self.players[id].disconnect()
@@ -1844,10 +1839,11 @@
         except Exception, e: self.log_msg(str(e))
         self.log_msg("Explicit garbage collection shows %s undeletable items." % str(gc.collect()))
 
-    def incoming_player_handler(self,xml_dom,data):
-        id = xml_dom.getAttribute("id")
-        act = xml_dom.getAttribute("action")
-        #group_id = xml_dom.getAttribute("group_id")
+    def incoming_player_handler(self, xml_dom, data):
+        debug()
+        id = xml_dom.get("id")
+        act = xml_dom.get("action")
+        #group_id = xml_dom.get("group_id")
         group_id = self.players[id].group_id
         ip = self.players[id].ip
         self.log_msg("Player with IP: " + str(ip) + " joined.")
@@ -1859,21 +1855,22 @@
                 self.send_group_list(id)
             except Exception, e: traceback.print_exc()
         elif act=="del":
-            #print "del player"
             self.del_player(id,group_id)
             self.check_group(id, group_id)
         elif act=="update":
+            debug(xml_dom)
+            print xml_dom.get('name')
             self.players[id].take_dom(xml_dom)
             self.log_msg(("update", {"id": id,
-                                     "name": xml_dom.getAttribute("name"),
-                                     "status": xml_dom.getAttribute("status"),
-                                     "role": xml_dom.getAttribute("role"),
+                                     "name": xml_dom.get("name"),
+                                     "status": xml_dom.get("status"),
+                                     "role": xml_dom.get("role"),
 				     "ip":  str(ip),
-				     "group": xml_dom.getAttribute("group_id"),
-				     "room": xml_dom.getAttribute("name"),
-				     "boot": xml_dom.getAttribute("rm_boot"),
-				     "version": xml_dom.getAttribute("version"),
-				     "ping": xml_dom.getAttribute("time") \
+				     "group": xml_dom.get("group_id"),
+				     "room": xml_dom.get("name"),
+				     "boot": xml_dom.get("rm_boot"),
+				     "version": xml_dom.get("version"),
+				     "ping": xml_dom.get("time") \
                                      }))
 
     def strip_cheat_roll(self, string):
@@ -1895,10 +1892,12 @@
         return False
 
     def incoming_msg_handler(self,xml_dom,data):
+        debug()
         xml_dom, data = ServerPlugins.preParseIncoming(xml_dom, data)
-        to_id = xml_dom.getAttribute("to")
-        from_id = xml_dom.getAttribute("from")
-        group_id = xml_dom.getAttribute("group_id")
+        ###########################################################
+        to_id = xml_dom.get("to")
+        from_id = xml_dom.get("from")
+        group_id = xml_dom.get("group_id")
         end = data.find(">")
         msg = data[end+1:]
 
@@ -1943,14 +1942,15 @@
         return
 
     def sound_msg_handler(self, xml_dom, data):
-        from_id = xml_dom.getAttribute("from")
-        group_id = xml_dom.getAttribute("group_id")
+        debug()
+        from_id = xml_dom.get("from")
+        group_id = xml_dom.get("group_id")
         if group_id != 0: self.send_to_group(from_id, group_id, data)
 
     def plugin_msg_handler(self,xml_dom,data):
-        to_id = xml_dom.getAttribute("to")
-        from_id = xml_dom.getAttribute("from")
-        group_id = xml_dom.getAttribute("group_id")
+        to_id = xml_dom.get("to")
+        from_id = xml_dom.get("from")
+        group_id = xml_dom.get("group_id")
         end = data.find(">")
         msg = data[end+1:]
 
@@ -2002,9 +2002,9 @@
         try:
             given_boot_pwd = None
             try:
-                xml_dom = parseXml(msg)
-                xml_dom = xml_dom._get_documentElement()
-                given_boot_pwd = xml_dom.getAttribute("boot_pwd")
+                xml_dom = XML(msg)
+                #xml_dom = xml_dom._get_documentElement()
+                given_boot_pwd = xml_dom.get("boot_pwd")
 
             except:
                 print "Error in parse of boot message, Ignoring."
@@ -2102,14 +2102,14 @@
     ### Alpha ### Addition added to assist in Un Banning users.
     def admin_build_banlist(self):
         validate.config_file("ban_list.xml", "default_ban_list.xml" ) 
-        configDom = minidom.parse(dir_struct["user"] + 'ban_list.xml')
+        configDom = parse(dir_struct["user"] + 'ban_list.xml')
         self.ban_list = {}
-        for element in configDom.getElementsByTagName('banned'):
-            player = element.getAttribute('name').replace("&", "&amp;").replace("<", "&lt;").replace('"', "&quot;").replace(">", "&gt;")
-            ip = element.getAttribute('ip')
+        for element in configDom.findall('banned'):
+            player = element.get('name').replace("&", "&amp;").replace("<", "&lt;").replace('"', "&quot;").replace(">", "&gt;")
+            ip = element.get('ip')
             self.ban_list[ip] = {}
             self.ban_list[ip]['ip'] = ip
-            self.ban_list[ip]['name'] = element.getAttribute('name')
+            self.ban_list[ip]['name'] = element.get('name')
     ################
 
     def admin_banip(self, ip, name="", silent = 0):
@@ -2245,8 +2245,10 @@
 
     def send_group_list(self, to_id, action="new"):
         try:
+            print self.groups
             for key in self.groups:
                 xml = self.groups[key].toxml(action)
+                print xml, key
                 self.players[to_id].outbox.put(xml)
         except Exception, e:
             self.log_msg("Exception: send_group_list(): (client #"+to_id+") : " + str(e))
@@ -2303,10 +2305,10 @@
         """
         if not self.allowRemoteAdmin: return
         try:
-            pid = xml_dom.getAttribute("id")
+            pid = xml_dom.get("id")
             gid = ""
-            given_pwd = xml_dom.getAttribute("pwd")
-            cmd = xml_dom.getAttribute("cmd")
+            given_pwd = xml_dom.get("pwd")
+            cmd = xml_dom.get("cmd")
             server_admin_pwd = self.groups["0"].boot_pwd
             p_id = ""
             p_name= ""
@@ -2345,24 +2347,24 @@
                 msg ="<msg to='" + pid + "' from='0' group_id='" + gid + "'>" + self.player_list_remote()
                 self.players[pid].outbox.put(msg)
             elif cmd == "banip":
-                ip = xml_dom.getAttribute("bip")
-                name = xml_dom.getAttribute("bname")
+                ip = xml_dom.get("bip")
+                name = xml_dom.get("bname")
                 msg = "<msg to='" + pid + "' from='0' group_id='" + gid + "'> Banned: " + str(ip)
                 self.admin_banip(ip, name)
             elif cmd == "ban":
-                id = xml_dom.getAttribute("bid")
+                id = xml_dom.get("bid")
                 msg = "<msg to='" + id + "' from='0' group_id='" + gid + "'> Banned!"
                 self.players[pid].outbox.put(msg)
                 self.admin_ban(id, "")
             ### Alpha ### and untested
             elif cmd == "boot":
-                id = xml_dom.getAttribute("bid")
+                id = xml_dom.get("bid")
                 msg = "<msg to='" + id + "' from='0' group_id='" + gid + "'> Booted!"
                 self.players[pid].outbox.put(msg)
                 self.admin_kick(id, "")
             #############
             elif cmd == "unban":
-                ip = xml_dom.getAttribute("ip")
+                ip = xml_dom.get("ip")
                 self.admin_unban(ip)
                 msg = "<msg to='" + pid + "' from='0' group_id='" + gid + "'> Unbaned: " + str(ip)
                 self.players[pid].outbox.put(msg)
@@ -2370,7 +2372,7 @@
                 msg = "<msg to='" + pid + "' from='0' group_id='" + gid + "'>" + self.admin_banlist()
                 self.players[pid].outbox.put(msg)
             elif cmd == "killgroup":
-                ugid = xml_dom.getAttribute("gid")
+                ugid = xml_dom.get("gid")
                 if ugid == "0":
                     m = "<msg to='" + pid + "' from='0' group_id='" + gid + "'>"
                     m += "Cannot Remove Lobby! Remote administrator request denied!"
@@ -2381,15 +2383,15 @@
                     self.players[pid].outbox.put(msg)
 
             elif cmd == "message":
-                tuid = xml_dom.getAttribute("to_id")
-                msg = xml_dom.getAttribute("msg")
+                tuid = xml_dom.get("to_id")
+                msg = xml_dom.get("msg")
                 pmsg = "<msg to='" + tuid + "' from='0' group_id='" + self.players[tuid].group_id + "' >" + msg
                 try: self.players[tuid].outbox.put(pmsg)
                 except:
                     msg = "<msg to='" + pid + "' from='0' group_id='" + gid + ">Unknown Player ID: No message sent."
                     self.players[pid].outbox.put(msg)
             elif cmd == "broadcast":
-                bmsg = xml_dom.getAttribute("msg")
+                bmsg = xml_dom.get("msg")
                 self.broadcast(bmsg)
             elif cmd == "killserver" and self.allowRemoteKill:
                 #dangerous command..once server stopped it must be restarted manually
@@ -2407,21 +2409,21 @@
                 msg += self.RoomPasswords()
                 self.players[pid].outbox.put( msg)
             elif cmd == "createroom":
-                rm_name = xml_dom.getAttribute("name")
-                rm_pass = xml_dom.getAttribute("pass")
-                rm_boot = xml_dom.getAttribute("boot")
+                rm_name = xml_dom.get("name")
+                rm_pass = xml_dom.get("pass")
+                rm_boot = xml_dom.get("boot")
                 result = self.create_temporary_persistant_room(rm_name, rm_boot, rm_pass)
                 msg = "<msg to='" + pid + "' from='0' group_id='" + gid + "'>" + result
                 self.players[pid].outbox.put(msg)
             elif cmd == "nameroom":
-                rm_id   = xml_dom.getAttribute("rmid")
-                rm_name = xml_dom.getAttribute("name")
+                rm_id   = xml_dom.get("rmid")
+                rm_name = xml_dom.get("name")
                 result = self.change_group_name(rm_id,rm_name,pid)
                 msg ="<msg to='" + pid + "' from='0' group_id='" + gid + "'/>" + result
                 self.players[pid].outbox.put(msg)
             elif cmd == "passwd":
-                tgid = xml_dom.getAttribute("gid")
-                npwd = xml_dom.getAttribute("pass")
+                tgid = xml_dom.get("gid")
+                npwd = xml_dom.get("pass")
                 if tgid == "0":
                     msg ="<msg to='" + pid + "' from='0' group_id='" + gid + "'>"
                     msg += "Server password may not be changed remotely!"
--- a/orpg/networking/mplay_server_gui.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/networking/mplay_server_gui.py	Sat Oct 31 22:07:55 2009 -0500
@@ -9,10 +9,8 @@
 __cvsinfo__='$Id: mplay_server_gui.py,v 1.26 2007/11/06 00:32:39 digitalxero Exp $'[5:-2]
 __doc__="""OpenRPG Server Graphical Interface"""
 
-import os
-import sys
-import time
-import types
+import os, sys, time, types
+
 from orpg.dirpath import dir_struct
 #import orpg.systempath looks old
 from orpg.tools.validate import validate
@@ -23,6 +21,10 @@
 from mplay_server import mplay_server, server
 from xml.dom import minidom
 from orpg.orpgCore import component
+from orpg.tools.orpg_log import debug
+
+from xml.etree.ElementTree import ElementTree, Element, iselement
+from xml.etree.ElementTree import fromstring, tostring, parse
 
 # Constants ######################################
 SERVER_RUNNING = 1
@@ -91,6 +93,7 @@
 
 # ServerConfig Object ############################
 class ServerConfig:
+    debug()
     """ This class contains configuration
         setting used to control the server."""
 
@@ -115,6 +118,7 @@
 # Server Monitor #################################
 
 class ServerMonitor(Thread):
+    debug()
     """ Monitor thread for GameServer. """
     def __init__(self, cb, conf, name, pwd):
         """ Setup the server. """
@@ -125,6 +129,7 @@
         self.bootPwd = pwd
 
     def log(self, mesg):
+        debug()
         if type(mesg) == types.TupleType:
             func, msg = mesg
             event = MessageFunctionEvent( func, msg )
@@ -133,6 +138,7 @@
         del event
 
     def run(self):
+        debug()
         """ Start the server. """
         self.server = mplay_server(self.log, self.serverName )
         self.server.initServer(bootPassword=self.bootPwd, reg="No")
@@ -140,6 +146,7 @@
         while self.alive: time.sleep(3)
 
     def stop(self):
+        debug()
         """ Stop the server. """
         self.server.kill_server()
         self.alive = 0
@@ -204,6 +211,7 @@
         self.SetStringItem(i, 2, "NEW")
         self.SetStringItem(i, 3, self.roomList[0])
         self.SetStringItem(i, 4, self.stripHtml(player["version"]))
+        print self.stripHtml(player["role"])
         self.SetStringItem(i, 5, 'Lurker' if self.stripHtml(player["role"]) == '' else self.stripHtml(player["role"]))
         self.SetStringItem(i, 6, self.stripHtml(player["ip"]))
         self.SetStringItem(i, 7, "PING")
@@ -231,6 +239,7 @@
         if i > -1:
             self.SetStringItem(i, 1, self.stripHtml(player["name"]))
             self.SetStringItem(i, 2, self.stripHtml(player["status"]))
+            print self.stripHtml(player["role"])
             self.SetStringItem(i, 5, 'Lurker' if self.stripHtml(player["role"]) == '' else self.stripHtml(player["role"]))
             self.AutoAjust()
         else: self.add(player)
@@ -458,7 +467,8 @@
         self.Log( event.message )
 
     # Event handler for out logging event
-    def OnFunctionMessage( self, event ):
+    def OnFunctionMessage(self, event):
+        debug()
         self.callbacks[event.func]( event.message )
 
     ### Server Callbacks #####################################
--- a/orpg/orpg_version.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/orpg_version.py	Sat Oct 31 22:07:55 2009 -0500
@@ -4,7 +4,7 @@
 #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed)
 DISTRO = "Traipse Alpha"
 DIS_VER = "Ornery Orc"
-BUILD = "091030-00"
+BUILD = "091031-00"
 
 # This version is for network capability.
 PROTOCOL_VERSION = "1.2"
--- a/orpg/plugindb.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/plugindb.py	Sat Oct 31 22:07:55 2009 -0500
@@ -1,184 +1,211 @@
-import xmltramp
+from __future__ import with_statement
+
 from orpg.dirpath import dir_struct
-#import orpg.tools.validate
-from types import *
-from orpg.orpgCore import component
+from orpg.tools.validate import validate
+from orpg.tools.orpg_log import logger
 
-class PluginDB:
-    def __init__(self, filename="plugindb.xml"):
-        self.filename = dir_struct["user"] + filename
-        component.get('validate').config_file(filename,"default_plugindb.xml")
-        self.xml_dom = self.LoadDoc()
+from xml.etree.ElementTree import ElementTree, Element, parse
+from xml.etree.ElementPath import find
+
+class PluginDB(object):
+    etree = ElementTree()
+    filename = dir_struct["user"] + "plugindb.xml"
 
-    def GetString(self, plugname, strname, defaultval, verbose=0):
+    def __new__(cls, *args, **kwargs):
+        it = cls.__dict__.get("__it__")
+        if it is not None:
+            return it
+        cls.__it__ = it = object.__new__(cls)
+        it._init()
+        return it
+
+    def _init(self):
+        validate.config_file("plugindb.xml", "default_plugindb.xml")
+        self.LoadDoc()
+
+    def GetString(self, plugname, strname, defaultval="", verbose=False):
         strname = self.safe(strname)
-        for plugin in self.xml_dom:
-            if plugname == plugin._name:
-                for child in plugin._dir:
-                    if child._name == strname:
-                        #str() on this to make sure it's ASCII, not unicode, since orpg can't handle unicode.
-                        if verbose: print "successfully found the value"
-                        if len(child): return str( self.normal(child[0]) )
-                        else: return ""
-        else:
-            if verbose:
-                print "plugindb: no value has been stored for " + strname + " in " + plugname + " so the default has been returned"
+
+        plugin = self.etree.find(plugname)
+        if plugin is None or plugin.find(strname) is None:
+            msg = ["plugindb: no value has been stored for", strname, "in",
+                   plugname, "so the default has been returned"]
+            logger.info(' '.join(msg), verbose)
             return defaultval
 
+        logger.debug("successfully found the str value", verbose)
+        return self.normal(plugin.find(strname).text)
+
     def SetString(self, plugname, strname, val):
         val = self.safe(val)
         strname = self.safe(strname)
-        for plugin in self.xml_dom:##this isn't absolutely necessary, but it saves the trouble of sending a parsed object instead of a simple string.
-            if plugname == plugin._name:
-                plugin[strname] = val
-                plugin[strname]._attrs["type"] = "string"
-                self.SaveDoc()
-                return "found plugin"
-        else:
-            self.xml_dom[plugname] = xmltramp.parse("<" + strname + " type=\"string\">" + val + "</" + strname + ">")
-            self.SaveDoc()
-            return "added plugin"
+
+        plugin = self.etree.find(plugname)
+        if plugin is None:
+            plugin = Element(plugname)
+            self.etree.getroot().append(plugin)
+
+        str_el = plugin.find(strname)
+        if str_el is None:
+            str_el = Element(strname)
+            str_el.set('type', 'str')
+            plugin.append(str_el)
+        str_el.text = val
+        self.SaveDoc()
 
     def FetchList(self, parent):
         retlist = []
-        if not len(parent): return []
-        for litem in parent[0]._dir:
-            if len(litem):
-                if litem._attrs["type"] == "int": retlist += [int(litem[0])]
-                elif litem._attrs["type"] == "long": retlist += [long(litem[0])]
-                elif litem._attrs["type"] == "float": retlist += [float(litem[0])]
-                elif litem._attrs["type"] == "list": retlist += [self.FetchList(litem)]
-                elif litem._attrs["type"] == "dict": retlist += [self.FetchDict(litem)]
-                else: retlist += [str( self.normal(litem[0]) )]
-            else: retlist += [""]
+        for litem in parent.findall('lobject'):
+            if litem.get('type') == 'int': retlist.append(int(litem.text))
+            if litem.get('type') == 'bool': retlist.append(litem.text == 'True')
+            elif litem.get('type') == 'float': retlist.append(float(litem.text))
+            elif litem.get('type') == 'list': retlist.append(self.FetchList(litem))
+            elif litem.get('type') == 'dict': retlist.append(self.FetchDict(litem))
+            else: retlist.append(str(self.normal(litem.text)))
+        return retlist
+
+    def GetList(self, plugname, listname, defaultval=list(), verbose=False):
+        listname = self.safe(listname)
+        plugin = self.etree.find(plugname)
+
+        if plugin is None or plugin.find(listname) is None:
+            msg = ["plugindb: no value has been stored for", listname, "in",
+                   plugname, "so the default has been returned"]
+            logger.info(' '.join(msg), verbose)
+            return defaultval
+
+        retlist = self.FetchList(plugin.find(listname))
+        logger.debug("successfully found the list value", verbose)
         return retlist
 
-    def GetList(self, plugname, listname, defaultval, verbose=0):
-        listname = self.safe(listname)
-        for plugin in self.xml_dom:
-            if plugname == plugin._name:
-                for child in plugin._dir:
-                    if child._name == listname and child._attrs["type"] == "list":
-                        retlist = self.FetchList(child)
-                        if verbose: print "successfully found the value"
-                        return retlist
-        else:
-            if verbose:
-                print "plugindb: no value has been stored for " + listname + " in " + plugname + " so the default has been returned"
-            return defaultval
-
     def BuildList(self, val):
-        listerine = "<list>"
+        list_el = Element('list')
         for item in val:
-            if isinstance(item, basestring):#it's a string
-                listerine += "<lobject type=\"str\">" + self.safe(item) + "</lobject>"
-            elif isinstance(item, IntType):#it's an int
-                listerine += "<lobject type=\"int\">" + str(item) + "</lobject>"
-            elif isinstance(item, FloatType):#it's a float
-                listerine += "<lobject type=\"float\">" + str(item) + "</lobject>"
-            elif isinstance(item, LongType):#it's a long
-                listerine += "<lobject type=\"long\">" + str(item) + "</lobject>"
-            elif isinstance(item, ListType):#it's a list
-                listerine += "<lobject type=\"list\">" + self.BuildList(item) + "</lobject>"
-            elif isinstance(item, DictType):#it's a dictionary
-                listerine += "<lobject type=\"dict\">" + self.BuildDict(item) + "</lobject>"
+            i = Element('lobject')
+            if isinstance(item, bool):
+                i.set('type', 'bool')
+                i.text = str(item)
+            elif isinstance(item, int):#it's an int
+                i.set('type', 'int')
+                i.text = str(item)
+            elif isinstance(item, float):#it's a float
+                i.set('type', 'float')
+                i.text = str(item)
+            elif isinstance(item, (list, tuple)):#it's a list
+                i.set('type', 'list')
+                i.append(self.BuildList(item))
+            elif isinstance(item, dict):#it's a dictionary
+                i.set('type', 'dict')
+                i.append(self.BuildDict(item))
             else:
-                return "type unknown"
-        listerine += "</list>"
-        return listerine
+                i.set('type', 'str')
+                i.text = self.safe(item)
+            list_el.append(i)
+        return list_el
 
     def SetList(self, plugname, listname, val):
         listname = self.safe(listname)
-        list = xmltramp.parse(self.BuildList(val))
-        for plugin in self.xml_dom:
-            if plugname == plugin._name:
-                plugin[listname] = list
-                plugin[listname]._attrs["type"] = "list"
-                self.SaveDoc()
-                return "found plugin"
+        plugin = self.etree.find(plugname)
+        if plugin is None:
+            plugin = Element(plugname)
+            self.etree.getroot().append(plugin)
+        list_el = plugin.find(listname)
+        if list_el is None:
+            list_el = Element(listname)
+            list_el.set('type', 'list')
+            plugin.append(list_el)
         else:
-            self.xml_dom[plugname] = xmltramp.parse("<" + listname + "></" + listname + ">")
-            self.xml_dom[plugname][listname] = list
-            self.xml_dom[plugname][listname]._attrs["type"] = "list"
-            self.SaveDoc()
-            return "added plugin"
+            list_el.remove(list_el.find('list'))
+        list_el.append(self.BuildList(val))
+        self.SaveDoc()
 
     def BuildDict(self, val):
-        dictator = "<dict>"
-        for item in val.keys():
-            if isinstance(val[item], basestring):
-                dictator += "<dobject name=\"" + self.safe(item) + "\" type=\"str\">" + self.safe(val[item]) + "</dobject>"
-            elif isinstance(val[item], IntType):#it's an int
-                dictator += "<dobject name=\"" + self.safe(item) + "\" type=\"int\">" + str(val[item]) + "</dobject>"
-            elif isinstance(val[item], FloatType):#it's a float
-                dictator += "<dobject name=\"" + self.safe(item) + "\" type=\"float\">" + str(val[item]) + "</dobject>"
-            elif isinstance(val[item], LongType):#it's a long
-                dictator += "<dobject name=\"" + self.safe(item) + "\" type=\"long\">" + str(val[item]) + "</dobject>"
-            elif isinstance(val[item], DictType):#it's a dictionary
-                dictator += "<dobject name=\"" + self.safe(item) + "\" type=\"dict\">" + self.BuildDict(val[item]) + "</dobject>"
-            elif isinstance(val[item], ListType):#it's a list
-                dictator += "<dobject name=\"" + self.safe(item) + "\" type=\"list\">" + self.BuildList(val[item]) + "</dobject>"
+        dict_el = Element('dict')
+        for key, item in val.iteritems():
+            i = Element('dobject')
+
+            if isinstance(item, bool):
+                i.set('type', 'bool')
+                i.set('name', self.safe(key))
+                i.text = str(item)
+            elif isinstance(item, int):#it's an int
+                i.set('type', 'int')
+                i.set('name', self.safe(key))
+                i.text = str(item)
+            elif isinstance(item, float):#it's a float
+                i.set('type', 'float')
+                i.set('name', self.safe(key))
+                i.text = str(item)
+            elif isinstance(item, (list, tuple)):#it's a list
+                i.set('type', 'list')
+                i.set('name', self.safe(key))
+                i.append(self.BuildList(item))
+            elif isinstance(item, dict):#it's a dictionary
+                i.set('type', 'dict')
+                i.set('name', self.safe(key))
+                i.append(self.BuildDict(item))
             else:
-                return str(val[item]) + ": type unknown"
-        dictator += "</dict>"
-        return dictator
+                i.set('type', 'str')
+                i.set('name', self.safe(key))
+                i.text = self.safe(item)
+            dict_el.append(i)
+        return dict_el
 
-    def SetDict(self, plugname, dictname, val, file="plugindb.xml"):
+    def SetDict(self, plugname, dictname, val):
         dictname = self.safe(dictname)
-        dict = xmltramp.parse(self.BuildDict(val))
-        for plugin in self.xml_dom:
-            if plugname == plugin._name:
-                plugin[dictname] = dict
-                plugin[dictname]._attrs["type"] = "dict"
-                self.SaveDoc()
-                return "found plugin"
+        plugin = self.etree.find(plugname)
+        if plugin is None:
+            plugin = Element(plugname)
+            self.etree.getroot().append(plugin)
+        dict_el = plugin.find(dictname)
+        if dict_el is None:
+            dict_el = Element(dictname)
+            dict_el.set('type', 'dict')
+            plugin.append(dict_el)
         else:
-            self.xml_dom[plugname] = xmltramp.parse("<" + dictname + "></" + dictname + ">")
-            self.xml_dom[plugname][dictname] = dict
-            self.xml_dom[plugname][dictname]._attrs["type"] = "dict"
-            self.SaveDoc()
-            return "added plugin"
+            dict_el.remove(list_el.find('dict'))
+        dict_el.append(self.BuildDict(val))
+        self.SaveDoc()
 
     def FetchDict(self, parent):
         retdict = {}
-        if not len(parent):
-            return {}
-        for ditem in parent[0]._dir:
-            if len(ditem):
-                ditem._attrs["name"] = self.normal(ditem._attrs["name"])
-                if ditem._attrs["type"] == "int": retdict[ditem._attrs["name"]] = int(ditem[0])
-                elif ditem._attrs["type"] == "long": retdict[ditem._attrs["name"]] = long(ditem[0])
-                elif ditem._attrs["type"] == "float": retdict[ditem._attrs["name"]] = float(ditem[0])
-                elif ditem._attrs["type"] == "list": retdict[ditem._attrs["name"]] = self.FetchList(ditem)
-                elif ditem._attrs["type"] == "dict": retdict[ditem._attrs["name"]] = self.FetchDict(ditem)
-                else: retdict[ditem._attrs["name"]] = str( self.normal(ditem[0]) )
-            else: retdict[ditem._attrs["name"]] = ""
+        for ditem in parent.findall('dobject'):
+            key = self.normal(ditem.get('name'))
+            if ditem.get('type') == 'int': value = int(ditem.text)
+            elif ditem.get('type') == 'bool': value = ditem.text == 'True'
+            elif ditem.get('type') == 'float': value = float(ditem.text)
+            elif ditem.get('type') == 'list': value = self.FetchList(ditem)
+            elif ditem.get('type') == 'dict': value = self.FetchDict(ditem)
+            else: value = str(self.normal(ditem[0]))
+            retdict[key] = value
         return retdict
 
-    def GetDict(self, plugname, dictname, defaultval, verbose=0):
+    def GetDict(self, plugname, dictname, defaultval=dict(), verbose=False):
         dictname = self.safe(dictname)
-        for plugin in self.xml_dom:
-            if plugname == plugin._name:
-                for child in plugin._dir:
-                    if child._name == dictname and child._attrs["type"] == "dict": return self.FetchDict(child)
-        else:
-            if verbose:
-                print "plugindb: no value has been stored for " + dictname + " in " + plugname + " so the default has been returned"
+        plugin = self.etree.find(plugname)
+        if plugin is None or plugin.find(dictname) is None:
+            msg = ["plugindb: no value has been stored for", dictname, "in",
+                   plugname, "so the default has been returned"]
+            logger.info(' '.join(msg), verbose)
             return defaultval
+        retdict = self.FetchDict(plugin.find(dictname))
+        logger.debug("successfully found dict value", verbose)
+        return retdict
 
     def safe(self, string):
-        return string.replace("<", "$$lt$$").replace(">", "$$gt$$").replace("&","$$amp$$").replace('"',"$$quote$$")
+        return string.replace("<", "$$lt$$").replace(">", "$$gt$$")\
+               .replace("&","$$amp$$").replace('"',"$$quote$$")
 
     def normal(self, string):
-        return string.replace("$$lt$$", "<").replace("$$gt$$", ">").replace("$$amp$$","&").replace("$$quote$$",'"')
+        return string.replace("$$lt$$", "<").replace("$$gt$$", ">")\
+               .replace("$$amp$$","&").replace("$$quote$$",'"')
 
     def SaveDoc(self):
-        f = open(self.filename, "w")
-        f.write(self.xml_dom.__repr__(1, 1))
-        f.close()
+        with open(self.filename, "w") as f:
+            self.etree.write(f)
 
     def LoadDoc(self):
-        xml_file = open(self.filename)
-        plugindb = xml_file.read()
-        xml_file.close()
-        return xmltramp.parse(plugindb)
+        with open(self.filename) as f:
+            self.etree.parse(f)
+
+plugindb = PluginDB()
--- a/orpg/tools/orpg_log.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/tools/orpg_log.py	Sat Oct 31 22:07:55 2009 -0500
@@ -27,7 +27,7 @@
 #
 
 from __future__ import with_statement
-import sys, os, os.path, wx, time, traceback
+import sys, os, os.path, wx, time, traceback, inspect
 
 from orpg.orpgCore import component
 from orpg.external.terminalwriter import TerminalWriter
@@ -64,6 +64,24 @@
         wx.Yield()
         #sys.__stdout__.write(text)
 
+class TrueDebug(object):
+    ### Alpha ###
+    """A simple debugger. Add debug() to a function and it prints the function name and any objects included. 
+    Adding True to locale prints the file name where the function is. Adding False to log turns the log off.
+    This feature can be modified to trace deeper and find the bugs faster, ending the puzzle box."""
+    def __init__(self, objects=None, locale=False, log=True):
+        if log == False: return
+        current = inspect.currentframe()
+        self.true_debug(current, objects)
+
+    def true_debug(self, current, objects):
+        if objects != None:
+            if locale == True: print inspect.getouterframes(current)[1][3], objects, inspect.getouterframes(current)[1][1]
+            else: print inspect.getouterframes(current)[1][3], objects
+        else:
+            if locale == True: print inspect.getouterframes(current)[1][3], inspect.getouterframes(current)[1][1]
+            else: print inspect.getouterframes(current)[1][3]
+    
 class DebugConsole(wx.Frame):
     def __init__(self, parent):
         super(DebugConsole, self).__init__(parent, -1, "Debug Console")
@@ -215,3 +233,4 @@
 
 logger = orpgLog(dir_struct.get("user") + "runlogs/")
 crash = sys.excepthook = Crash
+debug = TrueDebug
--- a/orpg/tools/pluginui.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/tools/pluginui.py	Sat Oct 31 22:07:55 2009 -0500
@@ -1,17 +1,16 @@
 from orpg.orpg_wx import *
 from orpg.orpgCore import *
-import orpg.plugindb as plugindb
+from orpg.plugindb import plugindb
 from orpg.dirpath import dir_struct
 
-sys.path.append(dir_struct["plugins"])
+#sys.path.append(dir_struct["plugins"])
 
 class PluginFrame(wx.Frame):
     def __init__(self, parent):
         wx.Frame.__init__(self, parent, wx.ID_ANY, "Plugin Control Panel")
         self.panel = wx.Panel(self, wx.ID_ANY)
-        self.plugindb = plugindb.PluginDB()
         self.parent = parent
-        self.startplugs = self.plugindb.GetList("plugincontroller", "startup_plugins", [])
+        self.startplugs = plugindb.GetList("plugincontroller", "startup_plugins", [])
         self.available_plugins = {}
         self.enabled_plugins  = {}
         self.pluginNames = []
@@ -44,14 +43,13 @@
         self.btn_sizer = wx.BoxSizer(wx.HORIZONTAL)
         self.btn_sizer2 = wx.BoxSizer(wx.HORIZONTAL)
         self.head_sizer = wx.BoxSizer(wx.HORIZONTAL)
-        #pnl = wx.Panel(self.panel, wx.ID_ANY)
         self.err_sizer = wx.BoxSizer(wx.VERTICAL)
         self.err_sizer.Add(self.head_sizer, 0, wx.EXPAND)
         self.errorMessage = wx.StaticText(self.panel, wx.ID_ANY, "")
         self.err_sizer.Add(self.errorMessage, 0, wx.EXPAND)
         self.main_sizer.Add(self.err_sizer, 0, wx.EXPAND)
-        self.pluginList = wx.ListCtrl(self.panel, wx.ID_ANY, style=wx.LC_SINGLE_SEL|wx.LC_REPORT|wx.LC_HRULES|wx.LC_SORT_ASCENDING)
-        #self.pluginList.InsertColumn(0, "Autostart")
+        self.pluginList = wx.ListCtrl(self.panel, wx.ID_ANY, 
+                              style=wx.LC_SINGLE_SEL|wx.LC_REPORT|wx.LC_HRULES|wx.LC_SORT_ASCENDING)
         self.pluginList.InsertColumn(0, "Name")
         self.pluginList.InsertColumn(1, "Author")
         self.Bind(wx.EVT_LIST_ITEM_SELECTED, self._selectPlugin, self.pluginList)
@@ -128,12 +126,12 @@
         self.__doLayout()
 
     def __checkIdx(self, evt):
-        if isinstance(evt, int):
-            return evt
-        elif self._selectedPlugin is not None:
-            return self._selectedPlugin
+        if isinstance(evt, int): return evt
+        elif self._selectedPlugin is not None: return self._selectedPlugin
         else:
-            dlg = wx.MessageDialog(None, "You need to select a plugin before you can use this!", 'ERROR', wx.OK)
+            dlg = wx.MessageDialog(None, 
+                                   "You need to select a plugin before you can use this!", 
+                                   'ERROR', wx.OK)
             dlg.ShowModal()
             dlg.Destroy()
             return None
@@ -141,10 +139,12 @@
     def __impPlugin(self, pname):
         try:
             if "plugins." + pname in sys.modules:
-                del sys.modules["plugins." + pname]#to ensure that the newly-imported one will be used correctly. No, reload() is not a better way to do this.
+                del sys.modules["plugins." + pname] 
+                #to ensure that the newly-imported one will be used correctly. 
+                #No, reload() is not a better way to do this.
             mod = __import__("plugins." + pname)
             plugin = getattr(mod, pname)
-            pdata = plugin.Plugin(self.plugindb, self.parent)
+            pdata = plugin.Plugin(plugindb, self.parent)
             self.available_plugins[pdata.name] = [pname, pdata, pdata.author, pdata.help]
             return plugin
 
@@ -177,7 +177,9 @@
             self.autostartBtn.Label = "Disable Autostart"
 
         self.__doLayout()
-        self.pluginList.SetItemState(self._selectedPlugin, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
+        self.pluginList.SetItemState(self._selectedPlugin, 
+                                     wx.LIST_STATE_SELECTED, 
+                                     wx.LIST_STATE_SELECTED)
 
     def _deselectPlugin(self, evt):
         self.__disablePluginBtns()
@@ -185,12 +187,10 @@
 
     def _togglePlugin(self, evt):
         idx = evt.GetIndex()
-        pname = self.pluginList.GetItem(idx, 1).GetText()
+        pname = self.pluginList.GetItem(idx, 0).GetText()
         info = self.available_plugins[pname]
-        if info[0] in self.enabled_plugins:
-            self._disable(idx)
-        else:
-            self._enable(idx)
+        if info[0] in self.enabled_plugins: self._disable(idx)
+        else: self._enable(idx)
         self.pluginList.SetItemState(self._selectedPlugin, 0, wx.LIST_STATE_SELECTED)
 
     def _enableAll(self, evt):
@@ -225,10 +225,8 @@
 
     def _disableAll(self, evt):
         for entry in self.enabled_plugins.keys():
-            #print self.pluginList.FindItem(1, self.enabled_plugins[entry])
             idx = self.pluginList.FindItem(0, self.enabled_plugins[entry].name)
-            print self.pluginList
-            self._disable(idx) #New Method
+            self._disable(idx)
 
     def _disable(self, evt):
         idx = self.__checkIdx(evt)
@@ -252,36 +250,44 @@
 
     def _autostart(self, evt):
         idx = self.__checkIdx(evt)
-        if idx is None:
-            return
+        if idx is None: return
+        pname = self.pluginList.GetItem(idx, 0).GetText()
+        info = self.available_plugins[pname]
         if self.pluginList.GetItem(idx, 0).GetText() in self.startplugs:
             self.startplugs.remove(self.pluginList.GetItem(idx, 0).GetText())
             self.pluginList.SetItemImage(idx, 0, 0)
             self.autostartBtn.Label = "Autostart"
+            if info[0] in self.enabled_plugins:
+                dlg = wx.MessageDialog(None, 'Disable Plugin Now?', 'Plugin Enabled', 
+                    wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
+                dlg.ShowModal()
+                if dlg.ShowModal() == wx.ID_YES: self._disable(evt)
         else:
             self.startplugs.append(self.pluginList.GetItem(idx, 0).GetText())
             self.pluginList.SetItemImage(idx, 1, 0)
             self.autostartBtn.Label = "Disable Autostart"
+            if info[0] not in self.enabled_plugins:
+                dlg = wx.MessageDialog(None, 'Enable Plugin Now?', 'Plugin Disabled', 
+                    wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
+                if dlg.ShowModal() == wx.ID_YES: self._enable(evt)
 
-        self.plugindb.SetList("plugincontroller", "startup_plugins", self.startplugs)
+        plugindb.SetList("plugincontroller", "startup_plugins", self.startplugs)
         self.__doLayout()
 
     def _help(self, evt):
-        if isinstance(evt, int):
-            idx = evt
-        elif self._selectedPlugin is not None:
-            idx = self._selectedPlugin
+        if isinstance(evt, int): idx = evt
+        elif self._selectedPlugin is not None: idx = self._selectedPlugin
         else:
-            dlg = wx.MessageDialog(None, "You need to select a plugin before you can use this!", 'ERROR', wx.OK)
+            dlg = wx.MessageDialog(None, 
+                                   "You need to select a plugin before you can use this!", 
+                                   'ERROR', wx.OK)
             dlg.ShowModal()
             dlg.Destroy()
             return
 
-        pname = self.pluginList.GetItem(idx, 1).GetText()
+        pname = self.pluginList.GetItem(idx, 0).GetText()
         info = self.available_plugins[pname]
-
         msg = "Author(s):\t" + info[2] + "\n\n" + info[3]
-
         dlg = wx.MessageDialog(None, msg, 'Plugin Information: ' + pname, wx.OK)
         dlg.ShowModal()
         dlg.Destroy()
@@ -304,11 +310,9 @@
         i = 0
         for plugname, info in self.available_plugins.iteritems():
             self.pluginNames.append(plugname)
-            #idx = self.pluginList.InsertImageItem(self.pluginList.GetItemCount(), 0)
             idx = self.pluginList.InsertStringItem(self.pluginList.GetItemCount(), plugname)
             self.pluginList.SetStringItem(idx, 1, info[2])
             self.pluginList.SetItemImage(idx, 0, 0)
-            #self.pluginList.SetStringItem(idx, 1, plugname)
             if plugname in self.startplugs:
                 self.pluginList.SetItemImage(idx, 1, 0)
                 self._enable(idx)
@@ -316,7 +320,6 @@
             i += 1
         self.pluginList.SetColumnWidth(0, wx.LIST_AUTOSIZE)
         self.pluginList.SetColumnWidth(1, wx.LIST_AUTOSIZE)
-        #self.pluginList.SetColumnWidth(2, wx.LIST_AUTOSIZE)
         self.__doLayout()
         self.__disablePluginBtns()
 
--- a/orpg/tools/predTextCtrl.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/orpg/tools/predTextCtrl.py	Sat Oct 31 22:07:55 2009 -0500
@@ -353,30 +353,30 @@
         ExpandoTextCtrl._wrapLine = self._wrapLine
         
 
-        def _wrapLine(self, line, dc, width):
-            # Estimate where the control will wrap the lines and
-            # return the count of extra lines needed.
-            # Re writes ExpandoTextCtrl _wrapLine function
-            print 'New _wrapLine Function'
-            pte = dc.GetPartialTextExtents(line)
-            width -= wx.SystemSettings.GetMetric(wx.SYS_VSCROLL_X)
-            idx = 0
-            start = 0
-            count = 0
-            spc = -1
-            while idx < len(pte):
-                if line[idx] == ' ': spc = idx
-                if pte[idx] - start > width:
-                    # we've reached the max width, add a new line
-                    count += 1
-                # did we see a space? if so restart the count at that pos
-                if spc != -1:
-                    idx = spc + 1
-                    spc = -1
-                start = pte[idx]
-            else:
-                idx += 1
-            return count
+    def _wrapLine(self, line, dc, width):
+        # Estimate where the control will wrap the lines and
+        # return the count of extra lines needed.
+        # Re writes ExpandoTextCtrl _wrapLine function
+        print 'New _wrapLine Function'
+        pte = dc.GetPartialTextExtents(line)
+        width -= wx.SystemSettings.GetMetric(wx.SYS_VSCROLL_X)
+        idx = 0
+        start = 0
+        count = 0
+        spc = -1
+        while idx < len(pte):
+            if line[idx] == ' ': spc = idx
+            if pte[idx] - start > width:
+                # we've reached the max width, add a new line
+                count += 1
+            # did we see a space? if so restart the count at that pos
+            if spc != -1:
+                idx = spc + 1
+                spc = -1
+            start = pte[idx]
+        else:
+            idx += 1
+        return count
 
     # findWord subroutine.
     #
--- a/upmana/default_manifest.xml	Fri Oct 30 22:21:40 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<manifest>
-	<updaterepo>
-		<repo-Traipse type="string">http://hg.assembla.com/traipse</repo-Traipse>
-	</updaterepo>
-    <default>
-        <repo type="string">http://hg.assembla.com/traipse</repo>
-    </default>
-</manifest>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/upmana/default_upmana.xml	Sat Oct 31 22:07:55 2009 -0500
@@ -0,0 +1,8 @@
+<manifest>
+	<updaterepo>
+		<repo-Traipse type="string">http://hg.assembla.com/traipse</repo-Traipse>
+	</updaterepo>
+    <default>
+        <repo type="string">http://hg.assembla.com/traipse</repo>
+    </default>
+</manifest>
--- a/upmana/manifest.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/upmana/manifest.py	Sat Oct 31 22:07:55 2009 -0500
@@ -11,7 +11,7 @@
 
 class ManifestChanges(object):
     etree = ElementTree()
-    filename = dir_struct['home'] + 'upmana' + sep + 'updatemana.xml'
+    filename = dir_struct['home'] + 'upmana' + sep + 'upmana.xml'
 
     def __new__(cls, *args, **kwargs):
         it = cls.__dict__.get("__it__")
@@ -22,7 +22,7 @@
         return it
 
     def _init(self):
-        validate.config_file('updatemana.xml', "default_manifest.xml")
+        validate.config_file('upmana.xml', "default_upmana.xml")
         self.LoadDoc()
 
     def PluginChildren(self, plugname):
--- a/upmana/mercurial/hgweb/hgweb_mod.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/upmana/mercurial/hgweb/hgweb_mod.py	Sat Oct 31 22:07:55 2009 -0500
@@ -7,7 +7,7 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 import os
-from mercurial import ui, hg, hook, error, encoding, templater
+from upmana.mercurial import ui, hg, hook, error, encoding, templater
 from common import get_mtime, ErrorResponse
 from common import HTTP_OK, HTTP_BAD_REQUEST, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
 from common import HTTP_UNAUTHORIZED, HTTP_METHOD_NOT_ALLOWED
--- a/upmana/mercurial/hgweb/hgwebdir_mod.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/upmana/mercurial/hgweb/hgwebdir_mod.py	Sat Oct 31 22:07:55 2009 -0500
@@ -7,9 +7,9 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 import os, re, time
-from mercurial.i18n import _
-from mercurial import ui, hg, util, templater
-from mercurial import error, encoding
+from upmana.mercurial.i18n import _
+from upmana.mercurial import ui, hg, util, templater
+from upmana.mercurial import error, encoding
 from common import ErrorResponse, get_mtime, staticfile, paritygen,\
                    get_contact, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
 from hgweb_mod import hgweb
--- a/upmana/mercurial/hgweb/protocol.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/upmana/mercurial/hgweb/protocol.py	Sat Oct 31 22:07:55 2009 -0500
@@ -6,9 +6,9 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 import cStringIO, zlib, tempfile, errno, os, sys, urllib
-from mercurial import util, streamclone
-from mercurial.node import bin, hex
-from mercurial import changegroup as changegroupmod
+from upmana.mercurial import util, streamclone
+from upmana.mercurial.node import bin, hex
+from upmana.mercurial import changegroup as changegroupmod
 from common import ErrorResponse, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
 
 # __all__ is populated with the allowed commands. Be sure to add to it if
--- a/upmana/mercurial/hgweb/request.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/upmana/mercurial/hgweb/request.py	Sat Oct 31 22:07:55 2009 -0500
@@ -7,7 +7,7 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 import socket, cgi, errno
-from mercurial import util
+from upmana.mercurial import util
 from common import ErrorResponse, statusmessage
 
 shortcuts = {
--- a/upmana/mercurial/hgweb/server.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/upmana/mercurial/hgweb/server.py	Sat Oct 31 22:07:55 2009 -0500
@@ -7,10 +7,10 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 import os, sys, errno, urllib, BaseHTTPServer, socket, SocketServer, traceback
-from mercurial import hg, util, error
+from upmana.mercurial import hg, util, error
 from hgweb_mod import hgweb
 from hgwebdir_mod import hgwebdir
-from mercurial.i18n import _
+from upmana.mercurial.i18n import _
 
 def _splitURI(uri):
     """ Return path and query splited from uri
--- a/upmana/mercurial/hgweb/webcommands.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/upmana/mercurial/hgweb/webcommands.py	Sat Oct 31 22:07:55 2009 -0500
@@ -7,12 +7,12 @@
 
 import os, mimetypes, re, cgi, copy
 import webutil
-from mercurial import error, archival, templater, templatefilters
-from mercurial.node import short, hex
-from mercurial.util import binary
+from upmana.mercurial import error, archival, templater, templatefilters
+from upmana.mercurial.node import short, hex
+from upmana.mercurial.util import binary
 from common import paritygen, staticfile, get_contact, ErrorResponse
 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
-from mercurial import graphmod
+from upmana.mercurial import graphmod
 
 # __all__ is populated with the allowed commands. Be sure to add to it if
 # you're adding a new command, or the new command won't work.
--- a/upmana/mercurial/hgweb/webutil.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/upmana/mercurial/hgweb/webutil.py	Sat Oct 31 22:07:55 2009 -0500
@@ -7,8 +7,8 @@
 # GNU General Public License version 2, incorporated herein by reference.
 
 import os, copy
-from mercurial import match, patch, util, error
-from mercurial.node import hex, nullid
+from upmana.mercurial import match, patch, util, error
+from upmana.mercurial.node import hex, nullid
 
 def up(p):
     if p[0] != "/":
--- a/upmana/mercurial/hgweb/wsgicgi.py	Fri Oct 30 22:21:40 2009 -0500
+++ b/upmana/mercurial/hgweb/wsgicgi.py	Sat Oct 31 22:07:55 2009 -0500
@@ -9,7 +9,7 @@
 # http://www.python.org/dev/peps/pep-0333/#the-server-gateway-side
 
 import os, sys
-from mercurial import util
+from upmana.mercurial import util
 
 def launch(application):
     util.set_binary(sys.stdin)