예제 #1
0
파일: doc_search.py 프로젝트: xutaoding/bmp
 def get(self, page=None, pre_page=None):
     return self.succ(Doc.select(
         page,
         pre_page,
         _filters=self.get_search_fields(Doc),
         _orders=Doc.modify_time.desc()
     ))
예제 #2
0
파일: doc.py 프로젝트: xutaoding/bmp
    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)
예제 #3
0
파일: doc.py 프로젝트: cash2one/bmp
    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)
예제 #4
0
파일: doc.py 프로젝트: cash2one/bmp
    def post(self):
        submit = self.request()
        indexs = submit.pop("indexs") if submit.__contains__("indexs") else []
        fields = submit.pop("fields") if submit.__contains__("fields") else []

        submit["create_time"] = datetime.now()
        submit["create_uid"] = session[USER_SESSION]["uid"]
        submit["modify_time"] = datetime.now()
        submit["modify_uid"] = session[USER_SESSION]["uid"]

        doc = Doc.add(submit, auto_commit=False)

        doc.indexs = [Database.to_cls(DocIndex, index) for index in indexs]
        doc.fields = [Database.to_cls(DocField, field) for field in fields]

        db.session.commit()
        return self.succ()
예제 #5
0
파일: doc.py 프로젝트: xutaoding/bmp
    def post(self):
        submit = self.request()
        indexs = submit.pop("indexs") if submit.__contains__("indexs") else []
        fields = submit.pop("fields") if submit.__contains__("fields") else []

        submit["create_time"] = datetime.now()
        submit["create_uid"] = session[USER_SESSION]["uid"]
        submit["modify_time"] = datetime.now()
        submit["modify_uid"] = session[USER_SESSION]["uid"]

        doc = Doc.add(submit, auto_commit=False)

        doc.indexs = [Database.to_cls(DocIndex, index) for index in indexs]
        doc.fields = [Database.to_cls(DocField, field) for field in fields]

        db.session.commit()
        return self.succ()
예제 #6
0
파일: doc.py 프로젝트: cash2one/bmp
 def delete(self, did):
     Doc.delete(did, auto_commit=False)
     return self.success(DOC.DELETE, Doc, did)
예제 #7
0
파일: doc.py 프로젝트: cash2one/bmp
 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()))
예제 #8
0
파일: doc.py 프로젝트: cash2one/bmp
        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)
예제 #9
0
 def get(self, page=None, pre_page=None):
     return self.succ(
         Doc.select(page,
                    pre_page,
                    _filters=self.get_search_fields(Doc),
                    _orders=Doc.modify_time.desc()))
예제 #10
0
파일: doc.py 프로젝트: xutaoding/bmp
 def delete(self, did):
     Doc.delete(did, auto_commit=False)
     return self.success(DOC.DELETE, Doc, did)
예제 #11
0
파일: doc.py 프로젝트: xutaoding/bmp
 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()))
예제 #12
0
파일: doc.py 프로젝트: xutaoding/bmp
            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)