Il 02/07/2010 11:43, Gilles Lenfant ha scritto: > Le 2 juil. 2010 à 10:21, Yuri a écrit : > > >> Hi! >> >> I would like to add some method to an existing content type class. >> >> What I've done now is using schemaextender and a custom marker >> interface to a Document: >> >> class DocumentExtender(object): >> """Adapter that adds a Ripped Off From Channel field to News Items.""" >> adapts(IDocumentExtended) >> implements(IOrderableSchemaExtender) >> >> _fields = [ >> >> Schemaextender can add new fields, I would like now to add some new >> methods. From my understanding of ZCA, I've to write some adapter for >> the custom interface. Is it correct? Is there some code/product about >> this issue I can read from? >> > An adapter does not add any method to an existing class. Adapters work on > objects and not on classes.
Yes, to the object. I would like to have a .my_method() on objects with that marker interface set. So adapter should be the way. _______________________________________________ Product-Developers mailing list [email protected] http://lists.plone.org/mailman/listinfo/product-developers
