view upmana/validate.py @ 131:90d19eb43830 alpha

Traipse Alpha 'OpenRPG' {091003-03} 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 (See documentation for usage) Mercurial's hgweb folder is ported to upmana **Pretty important update that can help remove thousands of dead children from your gametree. **Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now. Check your gametree and look for dead children!! (Apparently I pasted from the OpenRPG folder. Wrong! Pro's or not, they need to eventually see the read text in their own debugger console.) Dead Node Children, now that's a O O -v-v- Happy Halloween!
author sirebral
date Tue, 03 Nov 2009 21:30:36 -0600
parents 496dbf12a6cb
children dcae32e219f1
line wrap: on
line source

# file: config_files.py
#
# Author: Todd Faris (Snowdog)
# Date:   5/10/2005
#
# Misc. config file service methods
#

from orpg.dirpath import dir_struct
import os

class Validate:
    def __init__(self, userpath=None):
        if userpath is None:
            userpath = dir_struct["home"] + os.sep + 'upmana' + os.sep
        self.__loadUserPath = userpath

    def config_file(self, user_file, template_file):
        #STEP 1: verify the template exists
        if (not os.path.exists(self.__loadUserPath + 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(self.__loadUserPath + 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()