コード例 #1
0
 def insertToolJson(self, json):
     toolmaterial = json['ToolMaterial']
     toolcolor = json['ToolColor']
     tooldescription = json['ToolDescription']
     resourceid = json['ResourceID']
     if resourceid and toolmaterial and toolcolor and tooldescription:
         dao = ToolsDAO()
         Toolsid = dao.insert(toolmaterial, toolcolor, tooldescription,
                              resourceid)
         result = self.build_tools_attributes(Toolsid, toolmaterial,
                                              toolcolor, tooldescription,
                                              resourceid)
         return jsonify(Tools=result), 201
     else:
         return jsonify(Error="Unexpected attributes in post request")
コード例 #2
0
 def insertTool(self, form):
     if (len(form) != 4):
         return jsonify(Error="Malformed post request"), 404
     resourceid = form['resourceid']
     toolmaterial = form['toolmaterial']
     toolcolor = form['toolcolor']
     tooldescription = form['tooldescription']
     if resourceid and toolmaterial and toolcolor and toolcolor:
         dao = ToolsDAO()
         toolid = dao.insert(resourceid, toolmaterial, toolcolor,
                             tooldescription)
         result = self.build_tools_attributes(toolid, resourceid,
                                              toolmaterial, toolcolor,
                                              tooldescription)
         return jsonify(Tool=result)
     else:
         return jsonify(Error="Unexpected attributes in post request"), 400