Example #1
0
 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)
Example #2
0
 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])
Example #3
0
 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)
Example #4
0
 def __init__(self,
              section='umlmachines',
              files=list_rcfiles('umlmachines.conf')):
     if section is None:
         section = 'database'
     Configuration.__init__(self, section=section, files=files)
Example #5
0
 def __init__(self, section=None, files=list_rcfiles('paellarc')):
     if section is None:
         section = 'database'
     Configuration.__init__(self, section=section, files=files)
Example #6
0
 def __init__(self, section=None, files=list_rcfiles('paellarc')):
     if section is None:
         section = 'database'
     Configuration.__init__(self, section=section, files=files)
Example #7
0
 def __init__(self, section='umlmachines',
              files=list_rcfiles('umlmachines.conf')):
     if section is None:
         section = 'database'
     Configuration.__init__(self, section=section, files=files)
Example #8
0
 def __init__(self, section=None, files=list_rcfiles("paellarc")):
     if section is None:
         section = "database"
     Configuration.__init__(self, section=section, files=files)