Mercurial > traipse_dev
comparison 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 |
comparison
equal
deleted
inserted
replaced
121:496dbf12a6cb | 122:36919b8a3ef9 |
---|---|
44 import sys | 44 import sys |
45 import random | 45 import random |
46 import traceback | 46 import traceback |
47 import re | 47 import re |
48 | 48 |
49 from xml.etree.ElementTree import ElementTree, Element, iselement | 49 from xml.etree.ElementTree import Element, fromstring |
50 from xml.etree.ElementTree import fromstring, tostring | |
51 | 50 |
52 metacache_lock = RLock() | 51 metacache_lock = RLock() |
53 | 52 |
54 def get_server_dom(data=None,path=None): | 53 def get_server_dom(data=None,path=None): |
55 # post data at server and get the resulting DOM | 54 # post data at server and get the resulting DOM |
155 | 154 |
156 # for each node found, we're going to check the nodes from prior | 155 # for each node found, we're going to check the nodes from prior |
157 # metas in the list. If a match is found, then use the new values. | 156 # metas in the list. If a match is found, then use the new values. |
158 for n in node_list: | 157 for n in node_list: |
159 # set them from current node | 158 # set them from current node |
160 if n.find('name') == None: n.set('name','NO_NAME_GIVEN') | 159 if not n.get('name'): n.set('name','NO_NAME_GIVEN') |
161 name = n.get('name') | 160 name = n.get('name') |
162 if n.find('num_users') == None: n.set('num_users','N/A') | 161 if not n.get('num_users'): n.set('num_users','N/A') |
163 num_users = n.get('num_users') | 162 num_users = n.get('num_users') |
164 if n.find('address') == None: n.set('address','NO_ADDRESS_GIVEN') | 163 if not n.get('address'): n.set('address','NO_ADDRESS_GIVEN') |
165 address = n.get('address') | 164 address = n.get('address') |
166 if n.find('port') == None: n.set('port','6774') | 165 if not n.get('port'): n.set('port','6774') |
167 port = n.get('port') | 166 port = n.get('port') |
168 n.set('meta',meta) | 167 n.set('meta',meta) |
169 end_point = str(address) + ":" + str(port) | 168 end_point = str(address) + ":" + str(port) |
170 if return_hash.has_key(end_point): | 169 if return_hash.has_key(end_point): |
171 if META_DEBUG: print "Replacing duplicate server entry at " + end_point | 170 if META_DEBUG: print "Replacing duplicate server entry at " + end_point |
475 "server_data[cookie]":self.cookie, | 474 "server_data[cookie]":self.cookie, |
476 "server_data[version]":PROTOCOL_VERSION, | 475 "server_data[version]":PROTOCOL_VERSION, |
477 "act":"unregister"} ) | 476 "act":"unregister"} ) |
478 try: # this POSTS the request and returns the result | 477 try: # this POSTS the request and returns the result |
479 xml_dom = get_server_dom(data=data, path=self.path) | 478 xml_dom = get_server_dom(data=data, path=self.path) |
480 if xml_dom.hasAttribute("errmsg"): | 479 if xml_dom.get("errmsg"): |
481 print "Error durring unregistration: " + xml_dom.get("errmsg") | 480 print "Error durring unregistration: " + xml_dom.get("errmsg") |
482 except: | 481 except: |
483 if META_DEBUG: print "Problem talking to Meta. Will go ahead and die, letting Meta remove us." | 482 if META_DEBUG: print "Problem talking to Meta. Will go ahead and die, letting Meta remove us." |
484 # If there's an error, echo it to the console | 483 # If there's an error, echo it to the console |
485 | 484 |
554 return 0 # indicates that it was okay to call, not that no errors occurred | 553 return 0 # indicates that it was okay to call, not that no errors occurred |
555 | 554 |
556 # If there is a DOM returned .... | 555 # If there is a DOM returned .... |
557 if etreeEl: | 556 if etreeEl: |
558 # If there's an error, echo it to the console | 557 # If there's an error, echo it to the console |
559 if etreeEl.hasAttribute("errmsg"): | 558 if etreeEl.get("errmsg"): |
560 print "Error durring registration: " + etreeEl.get("errmsg") | 559 print "Error durring registration: " + etreeEl.get("errmsg") |
561 if META_DEBUG: print data | 560 if META_DEBUG: print data |
562 if META_DEBUG: print | 561 if META_DEBUG: print |
563 """ | 562 """ |
564 No special handling is required. If the registration worked, id, cookie, and interval | 563 No special handling is required. If the registration worked, id, cookie, and interval |
580 """ | 579 """ |
581 try: | 580 try: |
582 self.interval = int(etreeEl.get("interval")) | 581 self.interval = int(etreeEl.get("interval")) |
583 self.id = etreeEl.get("id") | 582 self.id = etreeEl.get("id") |
584 self.cookie = etreeEl.get("cookie") | 583 self.cookie = etreeEl.get("cookie") |
585 if not etreeEl.hasAttribute("errmsg"): updateMetaCache(xml_dom) | 584 if not etreeEl.get("errmsg"): updateMetaCache(xml_dom) |
586 except: | 585 except: |
587 if META_DEBUG: print | 586 if META_DEBUG: print |
588 if META_DEBUG: print "OOPS! Is the Meta okay? It should be returning an id, cookie, and interval." | 587 if META_DEBUG: print "OOPS! Is the Meta okay? It should be returning an id, cookie, and interval." |
589 if META_DEBUG: print "Check to see what it really returned.\n" | 588 if META_DEBUG: print "Check to see what it really returned.\n" |
590 # Let xml_dom get garbage collected | 589 # Let xml_dom get garbage collected |