def get_viewset(self, filters=None, offset=None, limit=None): vs = ViewSet(self.db, self.get_viewset_id()) if (offset or offset == 0) and limit: off_lim = [int(offset), int(limit)] if offset == 0: return { "views": vs.get_all_views(filters=filters, offset=off_lim), "field_information": vs.data["field_information"], "fields": vs.fields, "sprite_sheets": vs.data.get("sprite_sheets"), "annotation_information": vs.data.get("annotation_information"), "base_image_url": "/data/{}/view_sets/{}/thumbnails/tn".format( self.db, vs.id), "total": vs.get_view_number()["count"] } else: return vs.get_all_views(filters=filters, offset=off_lim) else: return { "views": vs.get_all_views(filters=filters), "field_information": vs.data["field_information"], "fields": vs.fields, "sprite_sheets": vs.data.get("sprite_sheets"), "annotation_information": vs.data.get("annotation_information"), "base_image_url": "/data/{}/view_sets/{}/thumbnails/tn".format(self.db, vs.id) }
def get_view_set(db, vs_id): vs_id = int(vs_id) vs = ViewSet(db, vs_id) return json.dumps(vs.get_all_views())