def index(self): sess = self.sess rs = sess.query(*browse_field_list) data = todata(rs, fmap={'pwd': lambda x: ''}) sch, coldefs = build_schema(browse_field_list, self.request.localizer.translate) return dict(data=json_serializer(data), coldefs=json_serializer(coldefs), urls=json_serializer(self.urls))
def xhr_load_browse_data(self): sess = self.sess try: rs = sess.query(*browse_field_list) except sa.exc.SQLAlchemyError as exc: # TODO Log exception return hexc.HTTPException(detail=str(exc)) else: data = todata(rs, fmap={'pwd': lambda x: ''}) return data
def index(self): sess = self.sess rs = sess.query(*browse_field_list) data = todata(rs, fmap={'pwd': lambda x: ''}) sch, coldefs = build_schema( browse_field_list, self.request.localizer.translate) return dict( data=json_serializer(data), coldefs=json_serializer(coldefs), urls=json_serializer(self.urls) )
def xhr_load_entity(self): try: id_ = int(self.request.named_subpaths['id']) except (KeyError, ValueError): return hexc.HTTPBadRequest(detail=_tr(_("Missing ID"))) sess = self.sess try: entity = sess.query(pam.User).get(id_) except sa.exc.SQLAlchemyError as exc: # TODO Log exception return hexc.HTTPException(detail=str(exc)) else: if not entity: return hexc.HTTPNotFound(detail=_tr(_("Invalid ID"))) data = todata(entity, fmap={'pwd': lambda x: ''}) return data