def session(self): # NOTE: This uses a thread local store, allowing each greenthread to # have it's own session stored correctly. Without this, each # greenthread may end up using a single global session, which # leads to bad things happening. if not hasattr(self.local_store, 'session'): self.local_store.session = session.get_session(self.get_name()) return self.local_store.session
def __init__(self): super(SQLAlchemyStorage, self).__init__() self.engine = get_engine(self.name) self.session = get_session(self.name)
def get_session(self): return session.get_session(self.name, self.connection, self.target.id)
def start(self): super(PowerDNSBackend, self).start() self.session = get_session(self.name)