from sqlalchemy.orm.exc import NoResultFound
from config import Config
-from singleton import Singleton
from textutils import fix_maintainer
################################################################################
# Prepare BuildQueueFile object
qf = BuildQueueFile()
- qf.queue_id = self.queue_id
+ qf.build_queue_id = self.queue_id
qf.lastused = datetime.now()
qf.filename = poolfile_basename
- targetpath = qf.fullpath
+ targetpath = poolfile.fullpath
queuepath = os.path.join(self.path, poolfile_basename)
try:
- if self.copy_pool_files:
+ if self.copy_files:
# We need to copy instead of symlink
import utils
- utils.copy(targetfile, queuepath)
+ utils.copy(targetpath, queuepath)
# NULL in the fileid field implies a copy
qf.fileid = None
else:
- os.symlink(targetfile, queuepath)
+ os.symlink(targetpath, queuepath)
qf.fileid = poolfile.file_id
except OSError:
return None
################################################################################
-class DBConn(Singleton):
+class DBConn(object):
"""
database module init.
"""
+ __shared_state = {}
+
def __init__(self, *args, **kwargs):
- super(DBConn, self).__init__(*args, **kwargs)
+ self.__dict__ = self.__shared_state
- def _startup(self, *args, **kwargs):
- self.debug = False
- if kwargs.has_key('debug'):
- self.debug = True
- self.__createconn()
+ if not getattr(self, 'initialised', False):
+ self.initialised = True
+ self.debug = kwargs.has_key('debug')
+ self.__createconn()
def __setuptables(self):
self.tbl_architecture = Table('architecture', self.db_meta, autoload=True)