def __init__(self, conn, table, section, mainfield=None, mainvalue=None, option='name', value='value'): self.conn = conn self.cursor = StatementCursor(self.conn) self.cursor.set_table(table) self._secfield = section bothnone = mainfield is None and mainvalue is None bothset = mainfield and mainvalue if not bothnone and not bothset: raise Error, 'both mainfield and mainvalue need to be set/unset' self._mainclause = None if bothset: self._mainclause = Eq(mainfield, mainvalue) self._fields = [self._secfield, option, value] Configuration.__init__(self) for row in self.cursor.select(fields=self._fields, clause=self._mainclause): if row[0] not in self.sections(): self.add_section(row[0]) self.set(*row)
def __init__(self, section=None, files=list_rcfiles('paellarc')): if section is None: section = 'database' Configuration.__init__(self, section=section, files=files) if 'PAELLARC' in os.environ: paellarc = os.environ['PAELLARC'] print 'reading paellarc at', paellarc self.read([paellarc])
def __init__(self, section='umlmachines', files=list_rcfiles('umlmachines.conf')): if section is None: section = 'database' Configuration.__init__(self, section=section, files=files)
def __init__(self, section=None, files=list_rcfiles('paellarc')): if section is None: section = 'database' Configuration.__init__(self, section=section, files=files)
def __init__(self, section=None, files=list_rcfiles("paellarc")): if section is None: section = "database" Configuration.__init__(self, section=section, files=files)