comparison orpg/networking/meta_server_lib.py @ 195:b633f4c64aae alpha

Traipse Alpha 'OpenRPG' {100219-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 (Patch-2) New Features: New Namespace method with two new syntaxes Fixes: Fix to Server GUI startup errors Fix to Server GUI Rooms tab updating Fix to Chat and Settings if non existant die roller is picked Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated Fix to Alias Lib's Export to Tree, Open, Save features Fix to alias node, now works properly Fix to Splitter node, minor GUI cleanup
author sirebral
date Sat, 24 Apr 2010 08:37:20 -0500
parents 06f10429eedc
children 24769389a7ba
comparison
equal deleted inserted replaced
182:4b2884f29a72 195:b633f4c64aae
20 # 20 #
21 # File: meta_server_lib.py 21 # File: meta_server_lib.py
22 # Author: Chris Davis 22 # Author: Chris Davis
23 # Maintainer: 23 # Maintainer:
24 # Version: 24 # Version:
25 # $Id: meta_server_lib.py,v 1.40 2007/04/04 01:18:42 digitalxero Exp $ 25 # $Id: meta_server_lib.py,v Traipse 'Ornery-Orc' prof.ebral Exp $
26 # 26 #
27 # Description: A collection of functions to communicate with the meta server. 27 # Description: A collection of functions to communicate with the meta server.
28 # 28 #
29 29
30 30
37 from orpg.orpgCore import component 37 from orpg.orpgCore import component
38 from orpg.tools.validate import validate 38 from orpg.tools.validate import validate
39 from orpg.dirpath import dir_struct 39 from orpg.dirpath import dir_struct
40 40
41 import urllib, time, sys, traceback, re 41 import urllib, time, sys, traceback, re
42 #import orpg.minidom
43 42
44 from threading import * 43 from threading import *
45 from random import uniform 44 from random import uniform
46 from urllib import urlopen, urlencode 45 from urllib import urlopen, urlencode
47 from orpg.tools.orpg_log import debug 46 from orpg.tools.orpg_log import debug
48 47
49 from xml.etree.ElementTree import Element, fromstring 48 from xml.etree.ElementTree import Element, fromstring
50
51 metacache_lock = RLock() 49 metacache_lock = RLock()
52 50
53 def get_server_dom(data=None,path=None, string=False): 51 def get_server_dom(data=None,path=None, string=False):
54 # post data at server and get the resulting DOM 52 # post data at server and get the resulting DOM
55 if path == None: 53 if path == None:
312 meta_names.append(url) 310 meta_names.append(url)
313 return meta_names 311 return meta_names
314 312
315 def getMetaServerBaseURL(): 313 def getMetaServerBaseURL():
316 # get meta server URL 314 # get meta server URL
317 url = "http://www.openrpg.com/openrpg_servers.php" 315 url = "http://orpgmeta.appspot.com/"
318 try: 316 try:
319 component.get('validate').config_file("settings.xml","default_settings.xml") 317 component.get('validate').config_file("settings.xml","default_settings.xml")
320 ini = open(dir_struct["user"]+"settings.xml","r") 318 ini = open(dir_struct["user"]+"settings.xml","r")
321 txt = ini.read() 319 txt = ini.read()
322 xml = component.get('xml') 320 xml = component.get('xml')
323 tree = xml.parseXml(txt)._get_documentElement() 321 tree = xml.parseXml(txt)._get_documentElement()
324 ini.close() 322 ini.close()
325 node_list = tree.getElementsByTagName("MetaServerBaseURL") 323 node_list = tree.getElementsByTagName("MetaServerBaseURL")
326 if node_list: 324 if node_list:
327 url = node_list[0].getAttribute("value") 325 url = node_list[0].getAttribute("value")
326 print url
328 # allow tree to be collected 327 # allow tree to be collected
329 try: tree.unlink() 328 try: tree.unlink()
330 except: pass 329 except: pass
331 330
332 except Exception,e: 331 except Exception,e: