def get(self, page=None, pre_page=None, did=None): if did: return self.succ(Doc.get(did)) return self.succ( Doc.select(page, pre_page, _orders=Doc.modify_time.desc()))
def get(self, page=None, pre_page=None, did=None): if did: return self.succ(Doc.get(did)) return self.succ(Doc.select(page, pre_page, _orders=Doc.modify_time.desc()))
if submit.__contains__("opt_uid") and submit["opt_uid"]: if submit["opt_uid"] not in uids: raise ExceptionEx("不存在业务人 %s" % submit["opt_uid"]) def put(self, did): submit = self.request() indexs = submit.pop("indexs") if submit.__contains__( "indexs") else None fields = submit.pop("fields") if submit.__contains__( "fields") else None submit["id"] = did doc = Doc.edit(submit, auto_commit=False) if indexs != None: doc.indexs = [Database.to_cls(DocIndex, index) for index in indexs] if fields != None: doc.fields = [Database.to_cls(DocField, field) for field in fields] return self.success(DOC.PUT, Doc, submit) def delete(self, did): Doc.delete(did, auto_commit=False) return self.success(DOC.DELETE, Doc, did) if __name__ == "__main__": print Doc.get(3)
if submit["mainten_uid"] not in uids: raise ExceptionEx("不存在维护人 %s" % submit["mainten_uid"]) if submit.__contains__("opt_uid") and submit["opt_uid"]: if submit["opt_uid"] not in uids: raise ExceptionEx("不存在业务人 %s" % submit["opt_uid"]) def put(self, did): submit = self.request() indexs = submit.pop("indexs") if submit.__contains__("indexs") else None fields = submit.pop("fields") if submit.__contains__("fields") else None submit["id"] = did doc = Doc.edit(submit, auto_commit=False) if indexs != None: doc.indexs = [Database.to_cls(DocIndex, index) for index in indexs] if fields != None: doc.fields = [Database.to_cls(DocField, field) for field in fields] return self.success(DOC.PUT, Doc, submit) def delete(self, did): Doc.delete(did, auto_commit=False) return self.success(DOC.DELETE, Doc, did) if __name__ == "__main__": print Doc.get(3)