ソースを参照

Fix XOPP extension

Joeri Exelmans 3 年 前
親
コミット
fb79eca294
3 ファイル変更、27 行追加、24 行削除
  1. 6 3
      backend/dtdesign-backend
  2. 1 1
      drawio2oml/pm/oml_template_pm.j2
  3. 20 20
      flake.lock

+ 6 - 3
backend/dtdesign-backend

@@ -165,18 +165,21 @@ def render_pt(pt_iri):
 def put_xopp_file(model_name):
     if model_name[-5:] != ".xopp":
         return "File extension must be .xopp", 500
+    model_name_without_ext = model_name[:-5]
     xopp_data = flask.request.data # the file contents (gzipped XML)
     # Convert to OML and store the OML:
     try:
         xopp_as = xopp_parser.parseFile(io.BytesIO(initial_bytes=xopp_data))
-        with open(OML_ARTIFACT_DIR+'/'+model_name+"_xopp.oml", 'wt') as f:
+        with open(OML_ARTIFACT_DIR+'/'+model_name_without_ext+"_xopp.oml", 'wt') as f:
             xopp_oml_writer.writeOML(xopp_as,
                 inputfile=flask.request.url,
-                model_name=model_name,
+                model_name=model_name_without_ext,
                 namespaces=util.DTDESIGN_NAMESPACES, # use the namespaces from this repo
                 ostream=f)
     except Exception as e:
-        return str(e), 500
+        # print(e)
+        raise e
+        # return str(e), 500
     # If the above was successful, store the raw XOPP file:
     with open(XOPP_DIR+'/'+model_name, 'wb') as f:
         f.write(xopp_data)

+ 1 - 1
drawio2oml/pm/oml_template_pm.j2

@@ -16,7 +16,7 @@ pm:dataTo {{pm_names[outgoing]}} // for some reason, we have to explicitly creat
 {%- endmacro -%}
 {%- macro dataFlowSink(src) -%}
 {%- for incoming in src.data_incoming -%}
-//pm:dataFrom {{pm_names[incoming]}} // for some reason, we have to explicitly create the unreified relations on top of the reified relations (at the end of this file) or we get a reasoner error
+pm:dataFrom {{pm_names[incoming]}} // for some reason, we have to explicitly create the unreified relations on top of the reified relations (at the end of this file) or we get a reasoner error
 {%- endfor -%}
 {%- endmacro -%}
 

+ 20 - 20
flake.lock

@@ -6,11 +6,11 @@
         "nixpkgs": "nixpkgs"
       },
       "locked": {
-        "lastModified": 1683127584,
-        "narHash": "sha256-arPrpiiGpH/3Md0Dqdvdsm+6HvwlQj52StzX4Yx3l7Q=",
+        "lastModified": 1683193765,
+        "narHash": "sha256-LFWEYqPb7hXFLlkj2Nhrw9IFFtummS0iGzy/ky08gXo=",
         "ref": "refs/heads/master",
-        "rev": "edd90605278fe744edc4e9b33f831a9bbe88ebdb",
-        "revCount": 1992,
+        "rev": "61748e2a764cca8fdf3e8bda19489333107efbf9",
+        "revCount": 1993,
         "type": "git",
         "url": "ssh://git@msdl.uantwerpen.be/jexelmans/drawio.git"
       },
@@ -150,11 +150,11 @@
     },
     "nixpkgs": {
       "locked": {
-        "lastModified": 1683014792,
-        "narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=",
+        "lastModified": 1683194677,
+        "narHash": "sha256-Am7aCGNy/h6RMnvg7Pn4PHQXZZq9FyIUA9klYxBwyDI=",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42",
+        "rev": "0d8145a5d81ebf6698077b21042380a3a66a11c7",
         "type": "github"
       },
       "original": {
@@ -166,11 +166,11 @@
     },
     "nixpkgs_2": {
       "locked": {
-        "lastModified": 1683014792,
-        "narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=",
+        "lastModified": 1683194677,
+        "narHash": "sha256-Am7aCGNy/h6RMnvg7Pn4PHQXZZq9FyIUA9klYxBwyDI=",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42",
+        "rev": "0d8145a5d81ebf6698077b21042380a3a66a11c7",
         "type": "github"
       },
       "original": {
@@ -214,11 +214,11 @@
     },
     "nixpkgs_5": {
       "locked": {
-        "lastModified": 1683014792,
-        "narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=",
+        "lastModified": 1683194677,
+        "narHash": "sha256-Am7aCGNy/h6RMnvg7Pn4PHQXZZq9FyIUA9klYxBwyDI=",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42",
+        "rev": "0d8145a5d81ebf6698077b21042380a3a66a11c7",
         "type": "github"
       },
       "original": {
@@ -230,11 +230,11 @@
     },
     "nixpkgs_6": {
       "locked": {
-        "lastModified": 1683014792,
-        "narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=",
+        "lastModified": 1683194677,
+        "narHash": "sha256-Am7aCGNy/h6RMnvg7Pn4PHQXZZq9FyIUA9klYxBwyDI=",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42",
+        "rev": "0d8145a5d81ebf6698077b21042380a3a66a11c7",
         "type": "github"
       },
       "original": {
@@ -388,11 +388,11 @@
         "nixpkgs": "nixpkgs_6"
       },
       "locked": {
-        "lastModified": 1683119839,
-        "narHash": "sha256-vtyUKfMlC2msWZy1rO31qXWvaTbWwNtzzkT1yizQggM=",
+        "lastModified": 1683193970,
+        "narHash": "sha256-fZowla0g5ftO3iiKHbHLpiw8fCvQmGQOELGLMuvXZJY=",
         "ref": "refs/heads/master",
-        "rev": "df5f0b2d51032a1d421f12a9ee63ac0859742c59",
-        "revCount": 15,
+        "rev": "f6f90171a5e1e72e515e74ad7090b375ae6dc763",
+        "revCount": 17,
         "type": "git",
         "url": "ssh://git@msdl.uantwerpen.be/jexelmans/xopp2py.git"
       },