[Zope] Allow to import a function on protected code

Garito garito at sistes.net
Thu Jun 21 09:02:16 EDT 2007


Hi!
I write this module in a Product (I import some module's functions in the
product):

from AccessControl import ModuleSecurityInfo
modulesecurity = ModuleSecurityInfo()

def metodo(argumentos):
  here goes the method's code

modulesecurity.declarePublic('metodo')

modulesecurity.apply (globals())

Then I try to import in a Script Python like:

from Products.Product'sDirectory.Module'sName import metodo

But fails (ImportError)

I try to add to the module's code allow_module('metodo') with the same
result

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)

Can you point me where is the mistake?

This is the traceback for more clues:

Traceback (innermost last):
  Module ZPublisher.Publish, line 115, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 41, in call_object
  Module Products.Yanged.Yanged, line 166, in index_html
  Module Products.Yanged.Yanged, line 207, in __call__
  Module Products.Yanged.Yanged, line 234, in Ejecutar
  Module Products.Yanged.Yanged, line 207, in __call__
  Module Products.Yanged.Yanged, line 234, in Ejecutar
  Module Products.Yanged.Yanged, line 207, in __call__
  Module Products.Yanged.Yanged, line 234, in Ejecutar
  Module Products.Yanged.Yanged, line 207, in __call__
  Module Products.Yanged.Yanged, line 234, in Ejecutar
  Module Products.Yanged.Yanged, line 190, in __call__
  Module Products.Yanged.Yanged, line 234, in Ejecutar
  Module Shared.DC.Scripts.Bindings, line 311, in __call__
  Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
  Module Products.PythonScripts.PythonScript, line 326, in _exec
  Module None, line 1, in ResolverEquivalencias
   - <PythonScript at
/sistes.net/clientes/escobarsl.com/Comandos/ResolverEquivalencias used
for /sistes.net/clientes/escobarsl.com/Pagina/Editar/Sincronizar/ObtenerCaso/EditarArea/ResolverEquivalencias>
   - Line 1
  Module AccessControl.ZopeGuards, line 266, in guarded_import
  Module AccessControl.ZopeGuards, line 329, in load_module
Unauthorized: You are not allowed to access 'freemind' in this context


Thanks a lot! And sorry if I forget something :)
-- 
Mis Cosas
http://blogs.sistes.net/Garito
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20070621/563fab1c/attachment.htm


More information about the Zope mailing list