comparison upmana/validate.py @ 14:e8260c6cb309 grumpy-goblin

Traipse 'OpenRPG' {090806-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. 'Grumpy-Goblin' was created as a stablizing branch in an effort to remove bugs from core code. Update Summary: This build introduces Update Manager. Update Manager is a powerful tool in open beta that allows users more control over their Mercurial updates.
author sirebral
date Thu, 06 Aug 2009 18:09:36 -0500
parents
children 97265586402b
comparison
equal deleted inserted replaced
13:211ac836b6a0 14:e8260c6cb309
1 # file: config_files.py
2 #
3 # Author: Todd Faris (Snowdog)
4 # Date: 5/10/2005
5 #
6 # Misc. config file service methods
7 #
8
9 import orpg.dirpath
10 import os
11
12 class Validate:
13 def __init__(self, userpath=None):
14 if userpath is None:
15 userpath = orpg.dirpath.dir_struct["user"]
16 self.__loadUserPath = userpath
17
18 def config_file(self, user_file, template_file):
19 #STEP 1: verify the template exists
20 if (not os.path.exists(orpg.dirpath.dir_struct["template"] + template_file)):
21 return 0
22
23 #STEP 2: verify the user file exists. If it doesn't then create it from template
24 if (not os.path.exists(self.__loadUserPath + user_file)):
25 default = open(orpg.dirpath.dir_struct["template"] + template_file,"r")
26 file = default.read()
27 newfile = open(self.__loadUserPath + user_file,"w")
28 newfile.write(file)
29 default.close()
30 newfile.close()
31 return 2 #returning 2 (True) so calling method will know if file was created
32
33 #STEP 3: user file exists (is openable) return 1 indicating no-create operation required
34 else: return 1
35
36 def ini_entry(self, entry_name, ini_file):
37 pass