Ejemplo n.º 1
0
 def __init__(self, dsn=None, cfg=None):
     if dsn is None:
         dsn = PaellaConfig('database').get_dsn()
     if cfg is not None:
         deprecated('cfg parameter to PaellaConnection is deprecated')
         dsn = None
         if type(cfg) is PaellaConfig:
             dsn = cfg.get_dsn()
     if dsn is None:
         raise RuntimeError, 'Problem with the arguements to PaellaConnection'
     if os.environ.has_key('PAELLA_DBHOST'):
         dsn['dbhost'] = os.environ['PAELLA_DBHOST']
     if os.environ.has_key('PAELLA_DBNAME'):
         dsn['dbname'] = os.environ['PAELLA_DBNAME']
     if os.environ.has_key('PAELLA_DBPORT'):
         dsn['dbport'] = int(os.environ['PAELLA_DBPORT'])
         if dsn['dbport'] not in range(1, 65536):
             raise ValueError, 'bad database port %s' % dsn['dbport']
     user = dsn['dbusername']
     host = dsn['dbhost']
     dbname = dsn['dbname']
     passwd = dsn['dbpassword']
     if 'dbport' in dsn:
         port = dsn['dbport']
     else:
         port = 5432
     BasicConnection.__init__(self,
                              user=user,
                              host=host,
                              dbname=dbname,
                              passwd=passwd,
                              port=port)
     self.autocommit = 1
     self.__dict__['suitecursor'] = SuiteCursor(self)
Ejemplo n.º 2
0
 def __init__(self, conn):
     self.conn = conn
     self.suitecursor = SuiteCursor(self.conn)
     self.aptsrc = AptSourceHandler(self.conn)
     self.main_path = None
     self.profile = Profile(self.conn)
     self.family = Family(self.conn)
Ejemplo n.º 3
0
 def __init__(self, conn):
     self.conn = conn
     self.cursor = self.conn.cursor(statement=True)
     self.suitecursor = SuiteCursor(self.conn)
     self.init_db_element()
     if len(self.cursor.tables()):
         self.setup_cursors()
Ejemplo n.º 4
0
 def __init__(self, conn, cfg=None):
     object.__init__(self)
     self.conn = conn
     self.cfg = cfg
     self.__set_cursors__()
     self.main_path = None
     self.suitecursor = SuiteCursor(self.conn)
     self.aptsrc = AptSourceHandler(self.conn)