Exemplo n.º 1
0
        def get_from_database():
            session = DBSession()
            try:
                devices = session.query(cls).order_by(cls.name).all()
            except:
                devices = None

            return devices
Exemplo n.º 2
0
        def get_from_database():
            session = DBSession()
            try:
                devices = session.query(cls).order_by(cls.name).all()
            except:
                devices = None

            return devices
Exemplo n.º 3
0
        def get_from_database():
            session = DBSession()
            try:
                file = session.query(cls).filter(cls.filename == filename).one()
            except NoResultFound:
                file = None

            return file
Exemplo n.º 4
0
    def get_by_name(cls, name):
        session = DBSession()

        try:
            device = session.query(cls).filter(cls.name == name).one()
        except:
            device = None

        return device
Exemplo n.º 5
0
        def get_from_database():
            session = DBSession()
            try:
                file = session.query(cls).filter(
                    cls.filename == filename).one()
            except NoResultFound:
                file = None

            return file
Exemplo n.º 6
0
    def get_by_name(cls, name):
        session = DBSession()

        try:
            device = session.query(cls).filter(cls.name == name).one()
        except:
            device = None

        return device
Exemplo n.º 7
0
        def get_from_database():
            session = DBSession()
            query = session.query(cls)

            if device is not None:
                query = query.select_from(join(File, Device)). \
                            filter(Device.name == device)

            if type is not None:
                query = query.filter(cls.type == type)

            # Limit the query and order it
            query = query.order_by(desc(cls.date_created))[:20]

            return query
Exemplo n.º 8
0
        def get_from_database():
            session = DBSession()
            query = session.query(cls)

            if device is not None:
                query = query.select_from(join(File, Device)). \
                            filter(Device.name == device)

            if type is not None:
                query = query.filter(cls.type == type)

            # Limit the query and order it
            query = query.order_by(desc(cls.date_created))[:20]

            return query
Exemplo n.º 9
0
 def __call__(self, environ, start_response):
     session = DBSession()
     try:
         return self.app(environ, start_response)
     except:
         session.rollback()
     finally:
         session.close()
         DBSession.remove()
Exemplo n.º 10
0
 def __call__(self, environ, start_response):
     session = DBSession()
     try:
         return self.app(environ, start_response)
     except:
         session.rollback()
     finally:
         session.close()
         DBSession.remove()