Pardon, the traceback of option b was not correct, here is the right one -----Messaggio originale----- Da: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Per conto di Coletti Massimo Inviato: mercoledì 20 ottobre 2004 10.31 A: [EMAIL PROTECTED] Oggetto: [Zope-dev] Referencing a python method from a product page template
Hi, I am defining a Zope product to create a new portlet, the portlet will display some contents retrieved from a python module. Under the product dir I have a file queryBFE.py, with a method returnQuery(); the method returns a dictionary. In the __init__.py at product level, there is an: allow_module('Products.CorpQuotes.queryBFE') The portlet page template is stored under a skin directory, properly registered in CFM. In the portlet text, I tried two syntaxes to call the method: a) <span tal:define="modulo here/queryBFE; quotazione modulo/returnQuery;"> b) <span tal:define="quotazione modules/Products/CorpQuotes/queryBFE/returnQuery"> The first one returns: Exception Type AttributeError Exception Value queryBFE The second one returns: Exception Type Unauthorized Exception Value You are not allowed to access 'queryBFE' in this context Module Products.PageTemplates.TALES, line 220, in evaluate - URL: /Plone/FinnatHome_view - Line 14, Column 10 - Expression: standard:'modules/Products/CorpQuotes/queryBFE/returnQuery' - Names: {'container': <PloneSite instance at 0170EF50>, 'context': <Document at /Plone/index.html>, 'default': <Products.PageTemplates.TALES.Default instance at 0x010BF5F8>, 'here': <Document at /Plone/index.html>, 'loop': <SafeMapping instance at 025DEC30>, 'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x010AED00>, 'nothing': None, 'options': {'args': ()}, 'repeat': <SafeMapping instance at 025DEC30>, 'request': <HTTPRequest, URL=http://localhost:8082/index.html/FinnatHome_view>, 'root': <Application instance at 017C29E0>, 'template': <ZopePageTemplate at /Plone/FinnatHome_view used for /Plone/index.html>, 'traverse_subpath': [], 'user': coletti} Module Products.PageTemplates.Expressions, line 201, in __call__ Module Products.PageTemplates.Expressions, line 189, in _eval Module Products.PageTemplates.Expressions, line 145, in _eval - __traceback_info__: modules Module Products.PageTemplates.Expressions, line 340, in restrictedTraverse - __traceback_info__: {'path': ['Products', 'CorpQuotes', 'queryBFE', 'returnQuery'], 'TraversalRequestNameStack': ['returnQuery']} Unauthorized: You are not allowed to access 'queryBFE' in this context This e-mail and any attachments may contain confidential and privileged information. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this e-mail and destroy any copies. Any dissemination or use of this information by a person other than the intended recipient is unauthorized and may be illegal. _______________________________________________ Zope-Dev maillist - [EMAIL PROTECTED] http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )