<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
..shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
pre
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=FR link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>You&#8217;re welcome<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>(The message is
automatically added by the mail server, I can&#8217;t do anything about it :P
and I&#8217;m posting during my work so some might argue :D )<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>Jonathan<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>De&nbsp;:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> admin@sistes.net
[mailto:admin@sistes.net] <b><span style='font-weight:bold'>De la part de</span></b>
Garito<br>
<b><span style='font-weight:bold'>Envoyé&nbsp;:</span></b> jeudi 21 juin 2007
16:29<br>
<b><span style='font-weight:bold'>À&nbsp;:</span></b> Winterflood, Jonathan<br>
<b><span style='font-weight:bold'>Objet&nbsp;:</span></b> Re: [Zope] Allow to
import a function on protected code</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>Hi, Jonathan!<br>
<br>
The final right solution is:<br>
<br>
<span class=q><span id="q_1134e9e11c556698_1">from AccessControl import
ModuleSecurityInfo</span><br>
<span class=q>modulesecurity = ModuleSecurityInfo(</span></span></span></font><span
lang=EN-GB>'Products.Product'sDirectory.Module'sName'</span><span class=q><span
id="q_1134e9e11c556698_1"> )</span><br>
<br>
<span class=q>def metodo(argumentos):</span><br>
<span class=q>&nbsp; here goes the method's code</span><br>
<br>
<span class=q>modulesecurity.declarePublic('metodo')</span><br>
<br>
</span>Thanks a lot!!!<br>
<br>
PD: this messages IS NOT property of CapGemini ;-)<o:p></o:p></p>

<div>

<p class=MsoNormal><span class=gmailquote><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>2007/6/21, Winterflood, Jonathan &lt; <a
href="mailto:jonathan.winterflood@capgemini.com">jonathan.winterflood@capgemini.com</a>&gt;:</span></font></span><o:p></o:p></p>

<div link=blue vlink=blue>

<div>

<p><font size=2 color=navy face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;color:navy'>Hi,</span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;color:navy'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;color:navy'>I believe you should write</span></font><o:p></o:p></p>

<p><font size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'>modulesecurity
= ModuleSecurityInfo('Products.Product'sDirectory.Module'sName')</span></font><font
size=2 color=navy face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;color:navy'> </span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;color:navy'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;color:navy'>You may or may not need</span></font><o:p></o:p></p>

<p><font size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'>modulesecurity.apply
(globals())</span><o:p></o:p></font></p>

<div>

<p><font size=2 color=navy face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;color:navy'>What should it do?</span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;color:navy'>&nbsp;</span></font><o:p></o:p></p>

<p><font size=2 color=navy face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;color:navy'>Jonathan</span></font><o:p></o:p></p>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center>

</span></font></div>

<p><b><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
font-weight:bold'>De&nbsp;:</span></font></b><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'> <a
href="mailto:zope-bounces@zope.org" target="_blank">zope-bounces@zope.org</a>
[mailto:<a href="mailto:zope-bounces@zope.org" target="_blank">
zope-bounces@zope.org</a>] <b><span style='font-weight:bold'>De la part de</span></b>
Garito<br>
<b><span style='font-weight:bold'>Envoyé&nbsp;:</span></b> jeudi 21 juin 2007
15:02<br>
<b><span style='font-weight:bold'>À&nbsp;:</span></b> Zope user list<br>
<b><span style='font-weight:bold'>Objet&nbsp;:</span></b> [Zope] Allow to
import a function on protected code</span></font><o:p></o:p></p>

</div>

<div><span id="q_1134e9e11c556698_1">

<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Hi!<br>
I write this module in a Product (I import some module's functions in the
product):<br>
<br>
from AccessControl import ModuleSecurityInfo<br>
modulesecurity = ModuleSecurityInfo()<br>
<br>
def metodo(argumentos):<br>
&nbsp; here goes the method's code<br>
<br>
modulesecurity.declarePublic('metodo')<br>
<br>
modulesecurity.apply (globals())<br>
<br clear=all>
Then I try to import in a Script Python like:<br>
<br>
from Products.Product'sDirectory.Module'sName import metodo<br>
<br>
But fails (ImportError)<br>
<br>
I try to add to the module's code allow_module('metodo') with the same result <br>
<br>
I try to import from Products.Product'sDirectory import metodo in the same way
I can Import FormValidationError (from Products.Formulator.Form import
FormValidationError where FormValidationError is on Errors.py not in Form.py)
but I have the same result (ImportError again)<br>
<br>
Can you point me where is the mistake?<br>
<br>
This is the traceback for more clues:<o:p></o:p></span></font></p>

<pre><font size=2 face="Courier New"><span style='font-size:10.0pt'>Traceback (innermost last):<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module ZPublisher.Publish<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>, line 115, in publish<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module ZPublisher.mapply, line 88, in mapply<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module ZPublisher.Publish, line 41, in call_object<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module Products.Yanged.Yanged, line 166, in index_html<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module Products.Yanged.Yanged<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>, line 207, in __call__<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module Products.Yanged.Yanged, line 234, in Ejecutar<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module Products.Yanged.Yanged, line 207, in __call__<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module Products.Yanged.Yanged, line 234, in Ejecutar<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module Products.Yanged.Yanged<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>, line 207, in __call__<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module Products.Yanged.Yanged, line 234, in Ejecutar<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module Products.Yanged.Yanged, line 207, in __call__<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module Products.Yanged.Yanged, line 234, in Ejecutar<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module Products.Yanged.Yanged<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>, line 190, in __call__<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module Products.Yanged.Yanged, line 234, in Ejecutar<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module Shared.DC.Scripts.Bindings, line 311, in __call__<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module <o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>Products.PythonScripts.PythonScript, line 326, in _exec<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module None, line 1, in ResolverEquivalencias<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp;&nbsp; - &lt;PythonScript at /sistes.net/clientes/escobarsl.com/Comandos/ResolverEquivalencias used for /sistes.net/clientes/escobarsl.com/Pagina/Editar/Sincronizar/ObtenerCaso/EditarArea/ResolverEquivalencias&gt;<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'><br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp;&nbsp; - Line 1<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module AccessControl.ZopeGuards, line 266, in guarded_import<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>&nbsp; Module AccessControl.ZopeGuards, line 329, in load_module<br>
<br>
<o:p></o:p></span></font></pre><pre><font size=2 face="Courier New"><span
style='font-size:10.0pt'>Unauthorized: You are not allowed to access 'freemind' in this context<o:p></o:p></span></font></pre><pre><font
size=2 face="Courier New"><span style='font-size:10.0pt'>&nbsp;<o:p></o:p></span></font></pre>

<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'><br>
Thanks a lot! And sorry if I forget something :)<br>
-- <br>
Mis Cosas<br>
<a href="http://blogs.sistes.net/Garito" target="_blank">http://blogs.sistes.net/Garito</a>
<o:p></o:p></span></font></p>

</div>

</div>

</div>

</span>

<table class=MsoNormalTable border=0 cellpadding=0>
 <tr>
  <td bgcolor=white style='background:white;padding:.75pt .75pt ..75pt .75pt'>
  <p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 color=black
  face="Times New Roman"><span style='font-size:12.0pt;color:black'>This
  message contains information that may be privileged or confidential and is
  the property of the Capgemini Group. It is intended only for the person to
  whom it is addressed. If you are not the intended recipient, you are not
  authorized to read, print, retain, copy, disseminate, distribute, or use this
  message or any part thereof. If you receive this message in error, please
  notify the sender immediately and delete all copies of this message. </span></font><o:p></o:p></p>
  </td>
 </tr>
</table>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
<br clear=all>
<br>
-- <br>
Mis Cosas<br>
<a href="http://blogs.sistes.net/Garito">http://blogs.sistes.net/Garito</a> <o:p></o:p></span></font></p>

</div>

</body>

</html>

<table><tr><td bgcolor=#ffffff><font color=#000000>This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.<br>
<br>
</font></td></tr></table>