diff orpg/networking/meta_server_lib.py @ 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 9314d63c0941
children 8827271fbe1b
line wrap: on
line diff
--- 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."