"ModuleSecurityInfo" is really convoluted and difficult to grasp.
Try to replace:
security=ModuleSecurityInfo() security.declarePublic('checkTranslationService')
by:
security=ModuleSecurityInfo('Products.JMUtils.TranslationUtils') security.declarePublic('checkTranslationService')
If necessary, also add
ModuleSecurityInfo('Products').declarePublic('JMUtils')
ModuleSecurityInfo('Products.JMUtils').declarePublic('TranslationUtils')
Ensure that "TranslationUtils" is imported by your "__init__". Otherwise, security declaration defined inside "TranslationUtils.py" are not executed and therefore do not take effect. Hi Dieter,
Thanks for your reply. Finally I got working. I did everything what you said, but it didn't work either. So, I just replace: <span tal:define="TranslationUtils modules/Products/JMUtils/TranslationUtils;"> Something comes here </span> by its python equivalent: <span tal:define="TranslationUtils python:modules['Products.JMUtils.TranslationUtils'];"> Something comes here </span> and guess what, it worked. I find this behaviour wird because according to the Zope book both statements should do the same. I will try to do a small test file and submit it again here, so, we can see either it's my error or a bug on zope. Regards, Josef _________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail
Josef Albert Meile wrote:
Thanks for your reply. Finally I got working. I did everything what you said, but it didn't work either. So, I just replace:
<span tal:define="TranslationUtils modules/Products/JMUtils/TranslationUtils;"> Something comes here </span>
by its python equivalent:
<span tal:define="TranslationUtils python:modules['Products.JMUtils.TranslationUtils'];"> Something comes here </span>
and guess what, it worked. I find this behaviour wird because according to the Zope book both statements should do the same. I will try to do a
Josef, I think the first case (TALES syntax) actually tries to *call* the modules TranslationUtils, whereas the latter (python syntax) doesn't -- it just references it. I think if you add a 'nocall' statement to the first case it will do what you want e.g.: <span tal:define="TranslationUtils nocall:modules/Products/JMUtils/TranslationUtils;"> Something comes here </span> Regards, Matt -- Matt Hamilton matth@netsight.co.uk Netsight Internet Solutions, Ltd. Business Vision on the Internet http://www.netsight.co.uk +44 (0)117 9090901 Web Design | Zope/Plone Development & Consulting | Co-location | Hosting
These two statements are NOT the same. 'modules' is a dictionary and you want to access the key 'Products.JMUtils.TranslationUtils' of this dictionary. The first statement has no way of figuring that out, I think. Stefan On Samstag, Mai 1, 2004, at 22:09 Europe/Vienna, Josef Albert Meile wrote:
Thanks for your reply. Finally I got working. I did everything what you said, but it didn't work either. So, I just replace:
<span tal:define="TranslationUtils modules/Products/JMUtils/TranslationUtils;"> Something comes here </span>
by its python equivalent:
<span tal:define="TranslationUtils python:modules['Products.JMUtils.TranslationUtils'];"> Something comes here </span>
and guess what, it worked. I find this behaviour wird because according to the Zope book both statements should do the same. I will try to do a small test file and submit it again here, so, we can see either it's my error or a bug on zope. -- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/
These two statements are NOT the same. 'modules' is a dictionary and you want to access the key 'Products.JMUtils.TranslationUtils' of this dictionary.
The first statement has no way of figuring that out, I think. Yes, I see the difference, but according to the Zope book that is the way to do it with a tales sintax.
Josef Albert Meile wrote at 2004-5-1 22:09 +0200:
... <span tal:define="TranslationUtils python:modules['Products.JMUtils.TranslationUtils'];"> Something comes here </span>
The equivalent path expression is: modules/Products.JMUtils.TranslationUtils -- Dieter
--- In zope@yahoogroups.com, Dieter Maurer <dieter@h...> wrote:
Josef Albert Meile wrote at 2004-5-1 22:09 +0200:
... <span tal:define="TranslationUtils python:modules['Products.JMUtils.TranslationUtils'];"> Something comes here </span>
The equivalent path expression is:
modules/Products.JMUtils.TranslationUtils Yes, that was the trick. Finally it worked. I think the zope book should be corrected, because the current example* is wrong:
""" Modules can be grouped into packages, which are simply a way of organizing and naming related modules. For instance, Zope's Python-based Scripts are provided by a collection of modules in the "PythonScripts" subpackage of the Zope "Products" package. In particular, the "standard" module in this package provides a number of useful formatting functions that are standard in the DTML "var" tag. The full name of this module is "Products.PythonScripts.standard", so you could get access to it using either of the following statements: tal:define="global pps modules/Products/PythonScripts/standard" tal:define="global pps python:modules['Products.PythonScripts.standard']" """* Taken from the Zope book section Python Modules: http://zope.org/Documentation/Books/ZopeBook/2_6Edition/AdvZPT.stx Thanks to all who helped me to clarify the sintax, Josef
Josef Meile wrote at 2004-5-2 20:18 +0200:
... Yes, that was the trick. Finally it worked. I think the zope book should be corrected, because the current example* is wrong:
The new edition "Zope 2.7 edition" is now under work as a "BackTalk" document. It is not on Zope.org, but a search engine will probably be able to locate it. "BackTalk" documents can be commented. You should add a comment for the section containing the error found by you. -- Dieter
participants (6)
-
Dieter Maurer -
Josef Albert Meile -
Josef Meile -
Josef Meile -
Matt Hamilton -
Stefan H. Holek