Browse Source

Root resource stores request

php2python
Holger Frey 7 years ago
parent
commit
3f5b98aaef
  1. 9
      ordr2/resources/__init__.py

9
ordr2/resources/__init__.py

@ -1,10 +1,11 @@
class Root(object): class Root(object):
''' Root resource '''
__name__ = None __name__ = None
__parent__ = None __parent__ = None
def __init__(self, request):
def root_factory(request): self._request = request
return Root()
def includeme(config): def includeme(config):
@ -14,5 +15,5 @@ def includeme(config):
Activate this setup using ``config.include('ordr2.resources')``. 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) config.add_static_view('static', 'ordr2:static', cache_max_age=3600)