Exemple #1
0
        # 
        # config - pointer to current configuration object
        # yes, no, true, false - various boolean values
        ns_dict['config'] = self

        for y in ( 'yes', 'true', 'YES', 'TRUE', 'Yes', 'True' ):
            ns_dict[y] = 1 
        for n in ( 'no', 'false', 'NO', 'FALSE', 'No', 'False' ):
            ns_dict[n] = 0

        ns = ns_dict.copy()

        try:
            exec code in ns
        except:
            trace = ErrorHandler.readError()

            raise SkunkStandardError, 'cannot parse config file %s :\n%s' % \
                                      ( realfile, trace )
        for k, v in ns.items():
            if type(v) not in (types.ModuleType, types.FunctionType) and \
               k not in [ '__builtins__' ] + ns_dict.keys() and k[0] != '_':
                # Check that it's not set on the command line
                if self.has_key(k) and self._dict[k].isSetCmdLine():
                    continue

                self[k] = v
                
        # Get rid of the _dir in path if we added it there
        if chdir and _dir:
            del sys.path[sys.path.index(_dir)]