Fix schema loading

Remove usage of deprecated importlib.resources.path
This commit is contained in:
Correl Roush 2024-02-21 17:26:20 -05:00
parent 2554900554
commit 61544ed521
2 changed files with 6 additions and 3 deletions

View file

@ -7,10 +7,11 @@ import tornado.template
import tornado_openapi3.testing
import yaml
import tutor
import tutor.database
import tutor.server
template_path = importlib.resources.path("tutor", "templates")
template_path = importlib.resources.files(tutor) / "templates"
template_loader = tornado.template.Loader(str(template_path))
openapi_spec_dict = yaml.safe_load(
template_loader.load("openapi.yaml").generate(

View file

@ -416,8 +416,10 @@ class StaticFileHandler(tornado.web.StaticFileHandler):
class Application(tornado.web.Application):
def __init__(self, **settings):
version = importlib.metadata.version(__package__)
with importlib.resources.path(__package__, "templates") as template_path:
settings.setdefault("template_path", template_path)
settings.setdefault(
"template_path",
importlib.resources.files(__package__) / "templates",
)
paths = [
(