From: Benoît Pin Date: Wed, 3 Jul 2013 21:06:13 +0000 (+0200) Subject: Indexation de la position par utilisation d'un adaptateur, plutôt que d'utiliser... X-Git-Url: https://svn.cri.ensmp.fr/git/Plinn.git/commitdiff_plain/e84ba700349f0777d7e94b6b7692f53fc6860e17 Indexation de la position par utilisation d'un adaptateur, plutôt que d'utiliser ProxyIndex, devenu obsolète. --- 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 @@ + + +