예제 #1
0
 def get(self,
         fields=None,
         query=None,
         order=None,
         offset=None,
         limit=None,
         depth=0):
     """
         Generic method to get projects data according to provided filtering options
     """
     if not isinstance(fields, dict):
         fields = None
     if query is None:
         query = {"id>0"}
     if order is None:
         order = "name"
     if offset is None:
         offset = 0
     if limit is None:
         limit = RANGE_MAX
     projects = Model.Session().query(Model.Project).filter_by(
         **query).order_by(order).limit(limit).offset(offset).all()
     for p in projects:
         p.init(depth)
     return projects
예제 #2
0
 def get(self,
         fields=None,
         query=None,
         order=None,
         offset=None,
         limit=None,
         depth=0):
     """
         Generic method to get users data according to provided filtering options
     """
     if not isinstance(fields, dict):
         fields = None
     if query is None:
         query = {}
     if order is None:
         order = "lastname"
     if offset is None:
         offset = 0
     if limit is None:
         limit = RANGE_MAX
     s = Model.Session()
     users = s.query(Model.User).filter_by(
         **query).order_by(order).limit(limit).offset(offset).all()
     for u in users:
         u.init(depth)
     return users
예제 #3
0
 def get(self,
         fields=None,
         query=None,
         order=None,
         offset=None,
         limit=None,
         depth=0):
     """
         Generic method to get subject data according to provided filtering options
     """
     if not isinstance(fields, dict):
         fields = None
     if query is None:
         query = {}
     if order is None:
         order = ["lastname", "firstname"]
     if offset is None:
         offset = 0
     if limit is None:
         limit = RANGE_MAX
     s = Model.Session()
     subjects = s.query(Model.Subject).filter_by(**query).order_by(
         ",".join(order)).limit(limit).offset(offset).all()
     for s in subjects:
         s.init(depth, True)
     return subjects
예제 #4
0
 def get(self,
         fields=None,
         query: str = None,
         order: str = None,
         offset: int = None,
         limit: int = None,
         depth: int = 0):
     """
         Generic method to get sample data according to provided filtering options
     """
     if not isinstance(fields, dict):
         fields = None
     if query is None:
         query = {}
     if order is None:
         order = "name"
     if offset is None:
         offset = 0
     if limit is None:
         limit = RANGE_MAX
     s = Model.Session()
     samples = s.query(Model.Sample).filter_by(
         **query).order_by(order).limit(limit).offset(offset).all()
     for s in samples:
         s.init(depth)
     return samples