aboutsummaryrefslogtreecommitdiff
path: root/bh20simplewebuploader/main.py
diff options
context:
space:
mode:
authorAdam Novak2020-04-17 11:14:35 -0700
committerAdam Novak2020-04-17 11:14:35 -0700
commit23526cb2215d3f6554ab4227c5931211153ff4e4 (patch)
treeda03a7d2bcfec9a04ce7adefac6b6860740e86f5 /bh20simplewebuploader/main.py
parent7cf44a7aed6dd190e16ac94958aefcf7bffed6a0 (diff)
downloadbh20-seq-resource-23526cb2215d3f6554ab4227c5931211153ff4e4.tar.gz
bh20-seq-resource-23526cb2215d3f6554ab4227c5931211153ff4e4.tar.lz
bh20-seq-resource-23526cb2215d3f6554ab4227c5931211153ff4e4.zip
Read schema from package resource
Diffstat (limited to 'bh20simplewebuploader/main.py')
-rw-r--r--bh20simplewebuploader/main.py6
1 files changed, 3 insertions, 3 deletions
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('/')