<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;}
pre
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle18
        {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 lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>Hi,<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'>I believe you should write<o:p></o:p></span></font></p>

<p class=MsoNormal><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'><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'>You may or may not need<o:p></o:p></span></font></p>

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

<div>

<p class=MsoNormal><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?<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>

<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'>
zope-bounces@zope.org [mailto:zope-bounces@zope.org] <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>

<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><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>
  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>
  Module ZPublisher.mapply, line 88, in mapply<br>
  Module ZPublisher.Publish, line 41, in call_object<br>
  Module Products.Yanged.Yanged, line 166, in index_html<br>
  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>
  Module Products.Yanged.Yanged, line 234, in Ejecutar<br>
  Module Products.Yanged.Yanged, line 207, in __call__<br>
  Module Products.Yanged.Yanged, line 234, in Ejecutar<br>
  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>
  Module Products.Yanged.Yanged, line 234, in Ejecutar<br>
  Module Products.Yanged.Yanged, line 207, in __call__<br>
  Module Products.Yanged.Yanged, line 234, in Ejecutar<br>
  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>
  Module Products.Yanged.Yanged, line 234, in Ejecutar<br>
  Module Shared.DC.Scripts.Bindings, line 311, in __call__<br>
  Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec<br>
  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>
  Module None, line 1, in ResolverEquivalencias<br>
   - &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>
   - Line 1<br>
  Module AccessControl.ZopeGuards, line 266, in guarded_import<br>
  Module AccessControl.ZopeGuards, line 329, in load_module<br>
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'><o:p>&nbsp;</o:p></span></font></pre>

<p class=MsoNormal><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">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>