예제 #1
0
    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'
        )
예제 #2
0
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
예제 #3
0
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
예제 #4
0
    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()
예제 #5
0
    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()
예제 #6
0
    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]
예제 #7
0
    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]
예제 #8
0
    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()
예제 #9
0
    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()
예제 #10
0
    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()
예제 #11
0
 def create_resource(self):
     return createContentInContainer(getSite(),
                                     'seantis.reservation.resource')
예제 #12
0
 def create_resource(self):
     return createContentInContainer(
         getSite(), 'seantis.reservation.resource'
     )