-
Notifications
You must be signed in to change notification settings - Fork 56
/
wrapper.py
53 lines (41 loc) · 1.46 KB
/
wrapper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
""" Wrapper
"""
from Acquisition import Implicit
from AccessControl import ClassSecurityInfo
from App.class_init import InitializeClass
from zope.traversing.interfaces import ITraversable
from zope.traversing.adapters import DefaultTraversable
from zope.interface import implements
from eea.facetednavigation.subtypes.interfaces import IFacetedWrapper
class FacetedWrapper(Implicit):
""" Wrap faceted navigable container
"""
implements(IFacetedWrapper, ITraversable)
security = ClassSecurityInfo()
def __init__(self, context):
self.context = context
def __call__(self, content=None):
self.content = content
return self.__of__(self.context)
security.declarePublic('getFolderContents')
def getFolderContents(self, *args, **kwargs):
""" Override getFolderContents script
"""
return self.content or ()
security.declarePublic('queryCatalog')
queryCatalog = getFolderContents
security.declarePublic('atctListAlbum')
def atctListAlbum(self, *args, **kwargs):
""" Override atctListAlbum script used by atct_album_view
"""
return {
'images': (),
'folders': (),
'subimages': (),
'others': self.getFolderContents(),
}
def traverse(self, name, furtherPath):
""" Make this wrapper traversable
"""
return DefaultTraversable(self.context).traverse(name, furtherPath)
InitializeClass(FacetedWrapper)