From 3f5b98aaefcc442a1020ed05a93ad709546778c6 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Wed, 27 Sep 2017 09:40:45 +0200 Subject: [PATCH] Root resource stores request --- ordr2/resources/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ordr2/resources/__init__.py b/ordr2/resources/__init__.py index 938d86a..ebb7a68 100644 --- a/ordr2/resources/__init__.py +++ b/ordr2/resources/__init__.py @@ -1,10 +1,11 @@ class Root(object): + ''' Root resource ''' + __name__ = None __parent__ = None - -def root_factory(request): - return Root() + def __init__(self, request): + self._request = request def includeme(config): @@ -14,5 +15,5 @@ def includeme(config): Activate this setup using ``config.include('ordr2.resources')``. ''' - config.set_root_factory(root_factory) + config.set_root_factory(Root) config.add_static_view('static', 'ordr2:static', cache_max_age=3600)