From 23526cb2215d3f6554ab4227c5931211153ff4e4 Mon Sep 17 00:00:00 2001 From: Adam Novak Date: Fri, 17 Apr 2020 11:14:35 -0700 Subject: Read schema from package resource --- bh20simplewebuploader/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bh20simplewebuploader') diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py index f5324a5..13c3fef 100644 --- a/bh20simplewebuploader/main.py +++ b/bh20simplewebuploader/main.py @@ -7,7 +7,7 @@ import sys import re import string import yaml -import urllib.request +import pkg_resources from flask import Flask, request, redirect, send_file, send_from_directory, render_template import os.path @@ -133,8 +133,8 @@ def generate_form(schema): return list(walk_fields(root_name)) -# At startup, we need to load the current metadata schema so we can make a form for it -METADATA_SCHEMA = yaml.safe_load(urllib.request.urlopen('https://raw.githubusercontent.com/arvados/bh20-seq-resource/master/bh20sequploader/bh20seq-schema.yml')) +# At startup, we need to load the metadata schema from the uploader module, so we can make a form for it +METADATA_SCHEMA = yaml.safe_load(pkg_resources.resource_stream("bh20sequploader", "bh20seq-schema.yml")) FORM_ITEMS = generate_form(METADATA_SCHEMA) @app.route('/') -- cgit v1.2.3