diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-11-01 18:22:55 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-11-01 18:22:55 +0200 |
commit | 4fed1867dcd5343f5c7d53592a43b8595bfb777f (patch) | |
tree | ea7ae8addca6f6b339b6ee038c0ff5c44c729e39 | |
parent | 29c0526cad0c47aa4a06c92dae521dff28c962a5 (diff) | |
download | qvisqve-4fed1867dcd5343f5c7d53592a43b8595bfb777f.tar.gz |
Fix: set base url for ResourceRouter
-rw-r--r-- | qvarn/api.py | 1 | ||||
-rw-r--r-- | qvarn/api_tests.py | 1 | ||||
-rw-r--r-- | qvarn/resource_router.py | 2 |
3 files changed, 4 insertions, 0 deletions
diff --git a/qvarn/api.py b/qvarn/api.py index a2f3e64..0ff402a 100644 --- a/qvarn/api.py +++ b/qvarn/api.py @@ -119,6 +119,7 @@ class QvarnAPI: coll.set_resource_type(rt) router = qvarn.ResourceRouter() + router.set_baseurl(self._baseurl) router.set_collection(coll) router.set_notifier(self.notify) routes = router.get_routes() diff --git a/qvarn/api_tests.py b/qvarn/api_tests.py index 23e6143..4567333 100644 --- a/qvarn/api_tests.py +++ b/qvarn/api_tests.py @@ -63,6 +63,7 @@ class QvarnAPITests(unittest.TestCase): api = qvarn.QvarnAPI() api.set_object_store(store) api.add_resource_type(rt) + api.set_base_url('https://qvarn.example.com') dirname = os.path.dirname(qvarn.__file__) dirname = os.path.join(dirname, '../resource_type') diff --git a/qvarn/resource_router.py b/qvarn/resource_router.py index ddfabe7..c9df68a 100644 --- a/qvarn/resource_router.py +++ b/qvarn/resource_router.py @@ -35,6 +35,8 @@ class ResourceRouter(qvarn.Router): self._notify = notify def get_routes(self): + assert self._baseurl is not None + rt = self._coll.get_type() path = rt.get_path() id_path = '{}/<id>'.format(path) |