Re: [Zope] using DOM from within Zope
[EMAIL PROTECTED] wrote: Maybe this is the wrong way or something, but how can I use xml.dom.minidom (or other module in its entirety) from within Zope? I've tried various stuff in the "MyScriptModules" Product. This same approach seems to work with the "re" module. I'd suggest that, rather than trying all this, you use the ParsedXML product from Infrae... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] using DOM from within Zope
A common approach is to isolate the functionality that uses the module(s) and put them in an Exernal Method or write a Product that incorporates them. These approaches give much more freedom than Python Scripts which are given limited access because of security issues. On Wed, 25 May 2005 [EMAIL PROTECTED] wrote: > Maybe this is the wrong way or something, but how can I use > xml.dom.minidom (or other module in its entirety) from within Zope? I've > tried various stuff in the "MyScriptModules" Product. This same approach > seems to work with the "re" module. > > Example: > > Products/MyScriptModules/__init__.py: > > from Products.PythonScripts.Utility import allow_module > ... > allow_module("xml") > allow_module("xml.dom") > allow_module("xml.dom.minidom") > > Python Script "inside" Zope: > > import xml.dom.minidom > xmlstring="texttextexthejhejhej" > domtree=xml.dom.minidom.parseString(xmlstring) > return domtree.toxml() > > Result: > > Username/Password question. > > "Error Type: Unauthorized > Error Value: You are not allowed to access 'toxml' in this context" > > > ___ > Zope maillist - Zope@zope.org > http://mail.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://mail.zope.org/mailman/listinfo/zope-announce > http://mail.zope.org/mailman/listinfo/zope-dev ) > -- Dennis Allison * Computer Systems Laboratory * Gates 227 * Stanford University * Stanford CA 94305 * (650) 723-9213 * (650) 723-0033 fax * [EMAIL PROTECTED] * [EMAIL PROTECTED] ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] using DOM from within Zope
--On Mittwoch, 25. Mai 2005 21:16 Uhr +0200 [EMAIL PROTECTED] wrote: Maybe this is the wrong way or something, but how can I use xml.dom.minidom (or other module in its entirety) from within Zope? I've tried various stuff in the "MyScriptModules" Product. This same approach seems to work with the "re" module. Example: Products/MyScriptModules/__init__.py: from Products.PythonScripts.Utility import allow_module ... allow_module("xml") allow_module("xml.dom") allow_module("xml.dom.minidom") Python Script "inside" Zope: import xml.dom.minidom xmlstring="texttextexthejhejhej" domtree=xml.dom.minidom.parseString(xmlstring) return domtree.toxml() This is a FAQ: use external method or write a Zope product or look at TrustedExecutables by Dieter Maurer. -aj pgpJeh0kwplXU.pgp Description: PGP signature ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )