Mercurial > traipse_dev
view orpg/tools/validate.py @ 227:81d0bfd5e800 alpha
Traipse Alpha 'OpenRPG' {100612-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 (Preparing to close updates)
New Features:
New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order
Fixes:
Fix to InterParse that was causing an Infernal Loop with Namespace Internal
Fix to XML data, removed old Minidom and switched to Element Tree
Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread
Fix to metaservers.xml file not being created
author | sirebral |
---|---|
date | Sat, 12 Jun 2010 03:50:37 -0500 |
parents | c54768cffbd4 |
children |
line wrap: on
line source
from orpg.dirpath import dir_struct import os from orpg.orpgCore import component class Validate: def __init__(self, userpath=None): if userpath is None: userpath = dir_struct["user"] self.__loadUserPath = userpath def config_file(self, user_file, template_file): #STEP 1: verify the template exists if (not os.path.exists(dir_struct["template"] + template_file)): return 0 #STEP 2: verify the user file exists. If it doesn't then create it from template if (not os.path.exists(self.__loadUserPath + user_file)): default = open(dir_struct["template"] + template_file,"r") file = default.read() newfile = open(self.__loadUserPath + user_file,"w") newfile.write(file) default.close() newfile.close() return 2 #returning 2 (True) so calling method will know if file was created #STEP 3: user file exists (is openable) return 1 indicating no-create operation required else: return 1 def ini_entry(self, entry_name, ini_file): pass validate = Validate() component.add('validate', Validate())