Beispiel #1
0
 def view(self):
     item = self._get_artifact_item()
     if item:
         errmsg = ""
         tclass = functions.get_linci_artifact_scheme_class(item.type)
         if tclass:
             view_template = getattr(tclass,"view_template",None)
             if view_template:
                 response.template = view_template
     else:
         errmsg = "artifact not found"
     return {"errmsg":errmsg,"item":item}
Beispiel #2
0
 def view(self):
     item = self._get_artifact_item()
     if item:
         errmsg = ""
         tclass = functions.get_linci_artifact_scheme_class(item.type)
         if tclass:
             view_template = getattr(tclass, "view_template", None)
             if view_template:
                 response.template = view_template
     else:
         errmsg = "artifact not found"
     return {"errmsg": errmsg, "item": item}
Beispiel #3
0
    def api_get(self):
        if not functions.linci_artifact_has_permission("linci_artifact_read"):
            return json({"success":False,"msg":"error: have no permission"})
        item = self._get_artifact_item()
        if not item:
            return json({"success":False,"msg":"error: artifact not found"})

        d = item.to_dict()
        perm_update = functions.linci_artifact_has_permission("linci_artifact_update")
        d["aid"] = "%s-%s"%(d["asite"],d["aindex"])
        tclass = functions.get_linci_artifact_scheme_class(item.type)
        d["type_label"] = tclass.name
        d["action_fix"] = (not item.fixed) and item.ready and perm_update
        d["action_set_ready"] = (not item.ready) and perm_update

        files = request.values.get("files","false")
        if files=="true":
            LinciArtifactFile = get_model("linciartifactfile")
            l = LinciArtifactFile.filter(LinciArtifactFile.c.artifact==item.id)
            d["files"] = [i.to_dict() for i in l]

        return json({"success":True,"item":d})
Beispiel #4
0
    def api_get(self):
        if not functions.linci_artifact_has_permission("linci_artifact_read"):
            return json({"success": False, "msg": "error: have no permission"})
        item = self._get_artifact_item()
        if not item:
            return json({"success": False, "msg": "error: artifact not found"})

        d = item.to_dict()
        perm_update = functions.linci_artifact_has_permission(
            "linci_artifact_update")
        d["aid"] = "%s-%s" % (d["asite"], d["aindex"])
        tclass = functions.get_linci_artifact_scheme_class(item.type)
        d["type_label"] = tclass.name
        d["action_fix"] = (not item.fixed) and item.ready and perm_update
        d["action_set_ready"] = (not item.ready) and perm_update

        files = request.values.get("files", "false")
        if files == "true":
            LinciArtifactFile = get_model("linciartifactfile")
            l = LinciArtifactFile.filter(
                LinciArtifactFile.c.artifact == item.id)
            d["files"] = [i.to_dict() for i in l]

        return json({"success": True, "item": d})