Re: Modifizieren eines ATDocuments vor dem Rendern

Robert Barsch <[email protected]>
Newsgroups gmane.comp.web.zope.german
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Jung schrieb:
> On 24.05.09 13:41, Robert Barsch wrote:
>>
>> hmm ATDocument.CookedBody ist in Plone 3 wohl nicht mehr dafür
>> nutzbar - 
> 
> Warum nicht?

Plone 3.2.2
__init__.py des Produktes

> from Products.ATContentTypes.content.document import ATDocument
> import logging
>
> logger=logging.getLogger("Plone")
>
> def myCookedBody(self, **kwargs):
>     logger.info("JUHU!")
>     text = self.getText()
>     text = 'muh' + text
>     return text
>
> ATDocument.CookedBody = myCookedBody
> logger.info("Patch applied")


"Patch applied" taucht beim Startup in den Logs auf - "JUHU!" bekomme
ich dagegen nicht, egal was ich tue ...

Übersehe ich irgendwas?

>> welche Methode kann ich den dann dafür "gefahrlos" patchen?
> 
> ggf. kannst Du via archetypes.schemaextender (oder auch via Monkeypatching)
> die Accessor Methode für 'body' auf eine eigene Methode umbiegen.
> Die eigene Methode kannst Du auch via Monkeypatching "dran flanschen" oder
> ggf. über dm.reuse().

mit schemaextender hatte ich es schon mal (leider erfolglos) probiert -
aber dabei den Accessor umzubiegen ist eine Idee - mal schauen wie weit
ich komme

Gruß + Dank,
Robert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFKGdsmIVowwEY4LjQRAhAbAKDk9So0o8IvnLXT4b8m5JOM/V67QgCdEAgh
UYMgfWrL6e2e1LEyL4XjYb4=
=0CK5
-----END PGP SIGNATURE-----


_______________________________________________
zope mailing list
[email protected]
https://mail.dzug.org/mailman/listinfo/zope
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.