Acquiring/accessing a dotted name
I have a Python (Script) object which needs to return the rendering of a page template called 'foo.html' return context.foo.html() will obviously not work. What will? I have tried various forms of the aq_acquire() call, but context does not seem to implement this. Importing the Acquisition module is not allowed--and it doesn't feel right to have to create a special security context for it. I must be missing something simple here, and yet it is incredibly difficult to find the answer I need from the various documentation I've looked at. Thanks aathan <Andrew Athan>
Ok, 50 minutes after I started looking I couldn't find the answer, so I emailed the group. 51 minutes after I started looking I found the answer in the "Advanced Scripting" area of the zope book, but not in relation to Python (Script) objects -- rather, in relation to python: attributes in TAL. I was trying too hard. A simple getattr(context,'viewBasket.html')() works just fine. Now ... any comments on idiomatic usage? A. -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Andrew Athan Sent: Wednesday, November 06, 2002 1:44 PM To: Zope@Zope. Org Subject: [Zope] Acquiring/accessing a dotted name I have a Python (Script) object which needs to return the rendering of a page template called 'foo.html' return context.foo.html() will obviously not work. What will? I have tried various forms of the aq_acquire() call, but context does not seem to implement this. Importing the Acquisition module is not allowed--and it doesn't feel right to have to create a special security context for it. I must be missing something simple here, and yet it is incredibly difficult to find the answer I need from the various documentation I've looked at. Thanks aathan <Andrew Athan> _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hello Andrew, Wednesday, November 6, 2002, 7:44:02 PM, you wrote: AA> I have a Python (Script) object which needs to return the rendering of a AA> page template called 'foo.html' AA> return context.foo.html() AA> will obviously not work. What will? footemplate = getattr(context,'foo.html') return footemplate() :) -- Geir Bækholt geir@funcom.com Tools/HCI-developer Tools/Billing - Product Operations Funcom Oslo
participants (2)
-
Andrew Athan -
Geir Bækholt