I am sending this to the general Zope list because I think this is not really CMF-specific even though it uses a type from CMFDefault: The News Item. I have a macro that does pretty much the standard news box thing (abbreviated): <metal:block define-macro="box" tal:define="results python:request.get('news', here.portal_catalog.searchResults( ... ));:> <tal:block repeat="obj results"> <span tal:replace="python:test(obj.Title, obj.Title, obj.id)" /> <span tal:replace="python:here.toPortalTime(obj.modified)" /> <span tal:replace="structure obj/description" /> <span tal:replace="structure obj/CookedBody" /> </tal:block> </metal:block> This macro is used by a template, which is used by a document to render itself. It works, but mostly doesn't. I can see ZCatalog returning a <mybrain instance> for each of the results. However, if I then try to use these mybrains instances the way I see e.g. Plone do it (the above is pretty much copied from Plone), it does weird things. The two news items I have created for testing purposes are named "First" and "Second", and they both have different descriptions and body texts. When I render the document (which uses a macro that uses the above macro), obj.Title seems to be "News Item" for both items, the description is empty, and CookedBody outputs the CookedBody of the document I am calling ('template') rather than the one of the object. However, looking at CMFDefault/NewsItem.py, News Item does sport 'description' and 'CookedBody', which is verified by looking at the Plone ZPTs using it that way. What is going on? The page in question is at http://tokyolectures.org, but I guess that doesn't really help a lot. Thanks, -- martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver! "montag, why do you burn books?" "it's a job like any other, pay is good and there is a lot of variety." -- ray bradbury (f451)
martin f krafft wrote:
<metal:block define-macro="box" tal:define="results python:request.get('news', here.portal_catalog.searchResults( ... ));:>
This is the only bit I can see that could cause problems. Why do you look in the REQUEST for something called 'news' first? Find where that's being set and I bet you'll findthe source fo your problem ;-) Chris
also sprach Chris Withers <chrisw@nipltd.com> [2003.08.28.1134 +0200]:
Why do you look in the REQUEST for something called 'news' first?
I don't know, Plone does it that way.
Find where that's being set and I bet you'll findthe source fo your problem
Tried taking it out, no success. -- martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver! friends help you move. real friends help you move bodies.
martin f krafft wrote:
also sprach Chris Withers <chrisw@nipltd.com> [2003.08.28.1134 +0200]:
Why do you look in the REQUEST for something called 'news' first?
I don't know, Plone does it that way.
Interesting ;-) If you change your code to the following, what gets output: <metal:block define-macro="box" tal:define="results python:request.get('news', here.portal_catalog.searchResults( ... ));:> <tal:block repeat="obj results"> <span tal:replace="obj/getPath" /><br> <span tal:replace="obj/meta_type" /><br> <span tal:replace="obj/portal_type" /><br><br> </tal:block> </metal:block> cheers, Chris
also sprach Chris Withers <chrisw@nipltd.com> [2003.08.29.1555 +0200]:
If you change your code to the following, what gets output:
i have found the solution. i simply do a define="item obj/getOject" and then use item instead of obj. this works
<span DEFANGED_tal:replace="obj/getPath" /><br> <span DEFANGED_tal:replace="obj/meta_type" /><br> <span DEFANGED_tal:replace="obj/portal_type" /><br><br>
do you still want me to do this? the meta_type is probably going to be mybrain, no? -- martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver! "in just seven days, i can make you a man!" -- the rocky horror picture show
participants (2)
-
Chris Withers -
martin f krafft