]> git.decadent.org.uk Git - dak.git/commitdiff
Merge branch 'dbtests' of ftp-master.debian.org:public_html/dak into dbtests
authorTorsten Werner <twerner@debian.org>
Thu, 3 Mar 2011 22:41:05 +0000 (23:41 +0100)
committerTorsten Werner <twerner@debian.org>
Thu, 3 Mar 2011 22:41:05 +0000 (23:41 +0100)
1  2 
daklib/dbconn.py

diff --combined daklib/dbconn.py
index ef93f52d9c87815696b5e38aee0969b43f05dee2,3806e31e2d09c9922c58014e9c0462d13e0a368b..c7ecdc189cb3125b132fb350fb4756193ce655ca
@@@ -3288,7 -3288,7 +3288,7 @@@ class DBConn(object)
          mapper(BinContents, self.tbl_bin_contents,
              properties = dict(
                  binary = relation(DBBinary,
-                     backref=backref('contents', lazy='dynamic')),
+                     backref=backref('contents', lazy='dynamic', cascade='all')),
                  file = self.tbl_bin_contents.c.file))
  
      ## Connection functions
              connstr = "postgres:///%s" % cnf["DB::Name"]
              if cnf["DB::Port"] and cnf["DB::Port"] != "-1":
                  connstr += "?port=%s" % cnf["DB::Port"]
 -        if not cnf.has_key('DB::PoolSize'):
 -            cnf['DB::PoolSize'] = '5'
 -        if not cnf.has_key('DB::MaxOverflow'):
 -            cnf['DB::MaxOverflow'] = '10'
 -
 -        self.db_pg   = create_engine(connstr, echo=self.debug,
 -            pool_size=int(cnf['DB::PoolSize']),
 -            max_overflow=int(cnf['DB::MaxOverflow']))
 +
 +        engine_args = { 'echo': self.debug }
 +        if cnf.has_key('DB::PoolSize'):
 +            engine_args['pool_size'] = int(cnf['DB::PoolSize'])
 +        if cnf.has_key('DB::MaxOverflow'):
 +            engine_args['max_overflow'] = int(cnf['DB::MaxOverflow'])
 +        if sa_major_version >= 0.6 and cnf.has_key('DB::Unicode') and \
 +            cnf['DB::Unicode'] == 'false':
 +            engine_args['use_native_unicode'] = False
 +
 +        self.db_pg   = create_engine(connstr, **engine_args)
          self.db_meta = MetaData()
          self.db_meta.bind = self.db_pg
          self.db_smaker = sessionmaker(bind=self.db_pg,