On Tue, 2010-12-14 at 01:20 -0800, Riccardo Lemmi-3 [via Plone (Regional forums)] wrote: > On Monday 13 December 2010, Diego Purpo wrote: > > Ciao a tutti. > > > > Sto cercando di eseguire una query al catalog che tra le varie > > condizioni preveda anche una del tipo "attributo not empty", ma > ancora > > non ho compreso come si possa realizzare. > > > > Qualcuno ha un suggerimento?! > > > > Grazie > > # in __init__.py > from plone.indexer.decorator import indexer > from zope.component import Interface > > @indexer(Interface) > def x_non_empty(obj): > if obj.getX() == "": #can raise an exception > return False > else: > return True > > Si può/deve mettere una interfaccia specifica per evitare che l'indice > venga > chiamato su un oggetto che non ha 'getX'. > > Per registrare l'indice mettere in configure.zcml: > > <adapter factory='.x_non_empty' name='x_non_empty' /> > > -- > Riccardo Lemmi Email: [hidden email] > Reflab S.r.l. - Plone Design, Development and Consulting > Phone: +39 349 4620820 http://www.reflab.com
ottimo! In effetti ero in attesa anche io di una soluzione più pulita. -- View this message in context: http://plone-regional-forums.221720.n2.nabble.com/Query-catalog-attribute-not-empty-tp5831502p5833908.html Sent from the Plone - Italy mailing list archive at Nabble.com. _______________________________________________ Plone-IT mailing list [email protected] http://lists.plone.org/mailman/listinfo/plone-it http://www.nabble.com/Plone---Italy-f21728.html
