equal
deleted
inserted
replaced
24 from zope.component.interfaces import IPossibleSite, ISite, ObjectEvent |
24 from zope.component.interfaces import IPossibleSite, ISite, ObjectEvent |
25 from zope.traversing.interfaces import IBeforeTraverseEvent, ITraversable |
25 from zope.traversing.interfaces import IBeforeTraverseEvent, ITraversable |
26 |
26 |
27 # import packages |
27 # import packages |
28 from persistent.dict import PersistentDict |
28 from persistent.dict import PersistentDict |
29 from pyams_utils.adapter import adapter_config |
29 from pyams_utils.adapter import adapter_config, ContextAdapter |
30 from pyams_utils.registry import get_utilities_for, query_utility |
30 from pyams_utils.registry import get_utilities_for, query_utility |
31 from pyramid.events import subscriber |
31 from pyramid.events import subscriber |
32 from pyramid.exceptions import NotFound |
32 from pyramid.exceptions import NotFound |
33 from pyramid.path import DottedNameResolver |
33 from pyramid.path import DottedNameResolver |
34 from pyramid.security import Allow, ALL_PERMISSIONS |
34 from pyramid.security import Allow, ALL_PERMISSIONS |
49 |
49 |
50 config_klass = None |
50 config_klass = None |
51 |
51 |
52 |
52 |
53 @adapter_config(name='etc', context=ISiteRoot, provides=ITraversable) |
53 @adapter_config(name='etc', context=ISiteRoot, provides=ITraversable) |
54 class SiteRootEtcTraverser(object): |
54 class SiteRootEtcTraverser(ContextAdapter): |
55 """Site root ++etc++ namespace traverser""" |
55 """Site root ++etc++ namespace traverser""" |
56 |
|
57 def __init__(self, context): |
|
58 self.context = context |
|
59 |
56 |
60 def traverse(self, name, furtherpath=None): |
57 def traverse(self, name, furtherpath=None): |
61 if name == 'site': |
58 if name == 'site': |
62 return self.context.getSiteManager() |
59 return self.context.getSiteManager() |
63 raise NotFound |
60 raise NotFound |