Loading src/doc2tosca.py +5 −2 Original line number Original line Diff line number Diff line Loading @@ -155,7 +155,7 @@ def dump_header(model_name, buf, spec_version=SPEC_VERSION, imports=None): MODELS = {} MODELS = {} def generate_templates(filename, spec_version=SPEC_VERSION): def generate_templates(filename, spec_version=SPEC_VERSION, yaml_root_path='uri'): ''' ''' Takes a filename or file object and loads the definition into the MODELS dictionary Takes a filename or file object and loads the definition into the MODELS dictionary ''' ''' Loading @@ -163,9 +163,12 @@ def generate_templates(filename, spec_version=SPEC_VERSION): print("Opening " + filename) print("Opening " + filename) for mn in MODEL_NAMES: for mn in MODEL_NAMES: import_stmt = 'etsi_nfv_sol001_common_types.yaml' if yaml_root_path != 'local': import_stmt = 'https://forge.etsi.org/rep/nfv/SOL001/raw/{}/'.format(spec_version) + import_stmt MODELS[mn] = tosca_model_info( MODELS[mn] = tosca_model_info( mn, mn, '- https://forge.etsi.org/rep/nfv/SOL001/raw/{}/etsi_nfv_sol001_common_types.yaml'.format(spec_version) '- ' + import_stmt ) ) try: try: Loading src/templates/home.html +6 −0 Original line number Original line Diff line number Diff line Loading @@ -86,6 +86,12 @@ For any other inquiry, contact <a href="mailto:cti_support@etsi.org">ETSI CTI</a <br /> <br /> Custom version (overrides the selector): Custom version (overrides the selector): <input type="text" name="custom-doc-version"> <input type="text" name="custom-doc-version"> <br /> Root of import statements: <select class="form-control form-control-sm" form="doc2tosca-form" name="yaml-root-path"> <option value="uri">Forge URL</option> <option value="local">Local (no path)</option> </select> <br /><br /> <br /><br /> <center> <center> <input type="submit" class="btn btn-primary" value="Upload" /> <input type="submit" class="btn btn-primary" value="Upload" /> Loading src/web_app.py +2 −1 Original line number Original line Diff line number Diff line Loading @@ -174,6 +174,7 @@ def mk_doc2tosca(): print(request.form) print(request.form) doc_version = request.form.get('doc-version') doc_version = request.form.get('doc-version') custom_doc_version = request.form.get('custom-doc-version') custom_doc_version = request.form.get('custom-doc-version') yaml_root_path = request.form.get('yaml-root-path') except: except: flash("Something went wrong :/") flash("Something went wrong :/") return redirect("/tosca-ie") return redirect("/tosca-ie") Loading @@ -187,7 +188,7 @@ def mk_doc2tosca(): if custom_doc_version != "": if custom_doc_version != "": doc_version = custom_doc_version doc_version = custom_doc_version try: try: doc2tosca.generate_templates(sol001_file, doc_version) doc2tosca.generate_templates(sol001_file, doc_version, yaml_root_path) except ValueError as e: except ValueError as e: flash(str(e)) flash(str(e)) return redirect("/tosca-ie") return redirect("/tosca-ie") Loading Loading
src/doc2tosca.py +5 −2 Original line number Original line Diff line number Diff line Loading @@ -155,7 +155,7 @@ def dump_header(model_name, buf, spec_version=SPEC_VERSION, imports=None): MODELS = {} MODELS = {} def generate_templates(filename, spec_version=SPEC_VERSION): def generate_templates(filename, spec_version=SPEC_VERSION, yaml_root_path='uri'): ''' ''' Takes a filename or file object and loads the definition into the MODELS dictionary Takes a filename or file object and loads the definition into the MODELS dictionary ''' ''' Loading @@ -163,9 +163,12 @@ def generate_templates(filename, spec_version=SPEC_VERSION): print("Opening " + filename) print("Opening " + filename) for mn in MODEL_NAMES: for mn in MODEL_NAMES: import_stmt = 'etsi_nfv_sol001_common_types.yaml' if yaml_root_path != 'local': import_stmt = 'https://forge.etsi.org/rep/nfv/SOL001/raw/{}/'.format(spec_version) + import_stmt MODELS[mn] = tosca_model_info( MODELS[mn] = tosca_model_info( mn, mn, '- https://forge.etsi.org/rep/nfv/SOL001/raw/{}/etsi_nfv_sol001_common_types.yaml'.format(spec_version) '- ' + import_stmt ) ) try: try: Loading
src/templates/home.html +6 −0 Original line number Original line Diff line number Diff line Loading @@ -86,6 +86,12 @@ For any other inquiry, contact <a href="mailto:cti_support@etsi.org">ETSI CTI</a <br /> <br /> Custom version (overrides the selector): Custom version (overrides the selector): <input type="text" name="custom-doc-version"> <input type="text" name="custom-doc-version"> <br /> Root of import statements: <select class="form-control form-control-sm" form="doc2tosca-form" name="yaml-root-path"> <option value="uri">Forge URL</option> <option value="local">Local (no path)</option> </select> <br /><br /> <br /><br /> <center> <center> <input type="submit" class="btn btn-primary" value="Upload" /> <input type="submit" class="btn btn-primary" value="Upload" /> Loading
src/web_app.py +2 −1 Original line number Original line Diff line number Diff line Loading @@ -174,6 +174,7 @@ def mk_doc2tosca(): print(request.form) print(request.form) doc_version = request.form.get('doc-version') doc_version = request.form.get('doc-version') custom_doc_version = request.form.get('custom-doc-version') custom_doc_version = request.form.get('custom-doc-version') yaml_root_path = request.form.get('yaml-root-path') except: except: flash("Something went wrong :/") flash("Something went wrong :/") return redirect("/tosca-ie") return redirect("/tosca-ie") Loading @@ -187,7 +188,7 @@ def mk_doc2tosca(): if custom_doc_version != "": if custom_doc_version != "": doc_version = custom_doc_version doc_version = custom_doc_version try: try: doc2tosca.generate_templates(sol001_file, doc_version) doc2tosca.generate_templates(sol001_file, doc_version, yaml_root_path) except ValueError as e: except ValueError as e: flash(str(e)) flash(str(e)) return redirect("/tosca-ie") return redirect("/tosca-ie") Loading