Kupu: wrong context in code source parameters
Marc Petitmermet <[email protected]>
| Newsgroups | gmane.comp.web.zope.silva.devel |
|---|---|
| Message-ID | <[email protected]> |
dear developers i wanted to fix my inline news viewer code source. the problem was that it gathered only the viewers in the context of the code source itself instead of the context of the silva document where it is embedded. this was the original code: parent = context.get_container() return [(item.get_title(),item.getId()) for item in parent.objectValues(['Silva News Viewer', 'Silva Agenda Viewer', 'Silva RSS Aggregator'])] i changed the code to the following: model = context.REQUEST.model parent = model.get_container() return [(item.get_title(),item.getId()) for item in parent.objectValues(['Silva News Viewer', 'Silva Agenda Viewer', 'Silva RSS Aggregator'])] this returns now to correct list of viewers (code source without parameters, only the above script). *but* when i use the above corrected code to populate the items of a list field for the parameters the context is again the code source itself and not the document where the code source is inserted. the workaround is to use the trusty forms editor (once again) because there, the list of viewers is correct! i add this to the issue tracker because this is a real bug (and i spent way to much time to recognize this). regards, marc