From e84ba700349f0777d7e94b6b7692f53fc6860e17 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Wed, 3 Jul 2013 23:06:13 +0200 Subject: [PATCH] =?utf8?q?Indexation=20de=20la=20position=20par=20utilisat?= =?utf8?q?ion=20d'un=20adaptateur,=20plut=C3=B4t=20que=20d'utiliser=20Prox?= =?utf8?q?yIndex,=20devenu=20obsol=C3=A8te.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Folder.py | 8 +------- catalog_adapters.py | 7 +++++++ overrides.zcml | 5 +++++ profiles/default/catalog.xml | 25 ++++++++++++++++++++++--- profiles/photo/catalog.xml | 6 ++++++ 5 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 catalog_adapters.py diff --git a/Folder.py b/Folder.py index e36dec8..0e3804f 100644 --- a/Folder.py +++ b/Folder.py @@ -269,16 +269,10 @@ class PlinnFolder(CMFCatalogAware, PortalFolder, DefaultDublinCoreImpl) : """ query catalog and returns brains of contents. Requires ExtendedPathIndex """ - #ctool = getToolByName(self, 'portal_catalog') ctool = getUtilityByInterfaceName('Products.CMFCore.interfaces.ICatalogTool') - #print ctool.absolute_url() contentFilter['path'] = {'query':'/'.join(self.getPhysicalPath()), 'depth':1} - try : - return ctool(sort_on='position', **contentFilter) - except : - return ctool(**contentFilter) - + return ctool(sort_on='position', **contentFilter) security.declarePublic('synContentValues') def synContentValues(self): diff --git a/catalog_adapters.py b/catalog_adapters.py new file mode 100644 index 0000000..64130ad --- /dev/null +++ b/catalog_adapters.py @@ -0,0 +1,7 @@ +from Products.CMFCore.CatalogTool import IndexableObjectWrapper + +class PlinnIndexableObjectWrapper(IndexableObjectWrapper) : + def position(self) : + parent = self.getParentNode() + pos = parent.getObjectPosition(self.getId()) + return pos \ No newline at end of file diff --git a/overrides.zcml b/overrides.zcml index 3059b05..bf37e72 100644 --- a/overrides.zcml +++ b/overrides.zcml @@ -10,4 +10,9 @@ provides="Products.CMFCore.interfaces.IMember" factory="Products.Plinn.MemberDataTool.MemberAdapter" /> + diff --git a/profiles/default/catalog.xml b/profiles/default/catalog.xml index 2ce7d81..10f32c2 100644 --- a/profiles/default/catalog.xml +++ b/profiles/default/catalog.xml @@ -18,7 +18,7 @@ True - False + True @@ -44,6 +44,9 @@ + + + True @@ -68,28 +71,40 @@ + + + + + + True - + + + + True + + + + - @@ -97,6 +112,7 @@ + @@ -105,9 +121,12 @@ + + + diff --git a/profiles/photo/catalog.xml b/profiles/photo/catalog.xml index 5ffb030..10f32c2 100644 --- a/profiles/photo/catalog.xml +++ b/profiles/photo/catalog.xml @@ -59,6 +59,9 @@ True + + + @@ -87,6 +90,9 @@ + + + -- 2.20.1