def resources(self): catalog = getToolByName(utils.getSite(), 'portal_catalog') path = '/'.join(self.getPhysicalPath()) return catalog( path={'query': path, 'depth': 2}, portal_type='seantis.reservation.resource' )
def upgrade_1009_to_1010(context): site = utils.getSite() all_resources = utils.portal_type_in_context(site, "seantis.reservation.resource", depth=100) for brain in all_resources: resource = brain.getObject() resource.approve_manually = resource.approve
def upgrade_1009_to_1010(context): site = utils.getSite() all_resources = utils.portal_type_in_context( site, 'seantis.reservation.resource', depth=100) for brain in all_resources: resource = brain.getObject() resource.approve_manually = resource.approve
def wrapper(context): util = getUtility(ISessionUtility) dsn = util.get_dsn(utils.getSite()) engine = create_engine(dsn) connection = engine.connect() try: fn(connection) finally: connection.close()
def sessionstore(self): """Returns the current sessionstore which will be populated with sessions if they are not yet present. """ dsn = self.get_dsn(utils.getSite()) if not hasattr(self._threadstore, 'sessions'): self._threadstore.sessions = {} if dsn not in self._threadstore.sessions: self._threadstore.sessions[dsn] = SessionStore(dsn) return self._threadstore.sessions[dsn]
def sessionstore(self): """Returns the current sessionstore which will be populated with sessions if they are not yet present. """ dsn = self.get_dsn(utils.getSite()) if not hasattr(self._threadstore, "sessions"): self._threadstore.sessions = {} if dsn not in self._threadstore.sessions: self._threadstore.sessions[dsn] = SessionStore(dsn) return self._threadstore.sessions[dsn]
def wrapper(context): util = getUtility(ISessionUtility) dsn = util.get_dsn(utils.getSite()) engine = create_engine(dsn, isolation_level='SERIALIZABLE') connection = engine.connect() transaction = connection.begin() try: context = MigrationContext.configure(connection) operations = Operations(context) metadata = MetaData(bind=engine) fn(operations, metadata) transaction.commit() except: transaction.rollback() raise finally: connection.close()
def wrapper(context): util = getUtility(ISessionUtility) dsn = util.get_dsn(utils.getSite()) engine = create_engine(dsn, isolation_level="SERIALIZABLE") connection = engine.connect() transaction = connection.begin() try: context = MigrationContext.configure(connection) operations = Operations(context) metadata = MetaData(bind=engine) fn(operations, metadata) transaction.commit() except: transaction.rollback() raise finally: connection.close()
def wrapper(context): # LIBRES this should be done by libres itself util = getUtility(ILibresUtility) dsn = util.get_dsn(utils.getSite()) engine = create_engine(dsn, isolation_level='SERIALIZABLE') connection = engine.connect() transaction = connection.begin() try: context = MigrationContext.configure(connection) operations = Operations(context) metadata = MetaData(bind=engine) fn(operations, metadata) transaction.commit() except: transaction.rollback() raise finally: connection.close()
def create_resource(self): return createContentInContainer(getSite(), 'seantis.reservation.resource')
def create_resource(self): return createContentInContainer( getSite(), 'seantis.reservation.resource' )