[Zope] Problem with regular expressions in python scripts (get an unauthorized error message)

Arnulf Heimsbakk arnulf@spirea.net
Tue, 31 Jul 2001 15:07:25 +0200


I'm trying to use a regular expression in python-script. It gives me an
unauthorized error every time I try to run it. Saving the script works
without errors. What do I do wrong..?!!

Here is my script:

Parameter list: str, newstr, expr="<[^>]*>"

import re
ret = ""

res = re.split(expr, str)

for x in len(res):
  ret = ret + res[x]
  ret = ret + newstr

ret = ret + res[len(res) - 1]

return ret

The full errormessage is as follows:

Traceback (innermost last):
  File /var/zope/Zope-2.3-ebok/lib/python/ZPublisher/Publish.py, line 223,
in publish_module
  File /var/zope/Zope-2.3-ebok/lib/python/ZPublisher/Publish.py, line 187,
in publish
  File /var/zope/Zope-2.3-ebok/lib/python/ZPublisher/Publish.py, line 171,
in publish
  File /var/zope/Zope-2.3-ebok/lib/python/ZPublisher/mapply.py, line 160, in
mapply
    (Object: re_replace)
  File /var/zope/Zope-2.3-ebok/lib/python/ZPublisher/Publish.py, line 112,
in call_object
    (Object: re_replace)
  File /var/zope/Zope-2.3-ebok/lib/python/Shared/DC/Scripts/Bindings.py,
line 324, in __call__
    (Object: re_replace)
  File /var/zope/Zope-2.3-ebok/lib/python/Shared/DC/Scripts/Bindings.py,
line 354, in _bindAndExec
    (Object: re_replace)
  File
/var/zope/Zope-2.3-ebok/lib/python/Products/PythonScripts/PythonScript.py,
line 336, in _exec
    (Object: re_replace)
    (Info: ({'script': &lt;PythonScript instance at 8a2caa8&gt;, 'context':
&lt;Folder instance at 8bdbf98&gt;, 'container': &lt;Folder instance at
8bdbf98&gt;, 'traverse_subpath': []}, ('hjkh', 'hkjh', '&lt;[^&gt;]*&gt;'),
{}, ('&lt;[^&gt;]*&gt;',)))
  File Script (Python), line 5, in re_replace
  File /var/zope/Zope-2.3-ebok/lib/python/Products/PythonScripts/Guarded.py,
line 273, in __getattr__
  File /var/zope/Zope-2.3-ebok/lib/python/Products/PythonScripts/Guarded.py,
line 150, in __careful_getattr__
    (Object: re)
  File /var/zope/Zope-2.3-ebok/lib/python/AccessControl/SecurityManager.py,
line 144, in validate
  File
/var/zope/Zope-2.3-ebok/lib/python/AccessControl/ZopeSecurityPolicy.py, line
168, in validate
Unauthorized: split

---
arnulf heimsbakk
system analyst
+47 76 14 45 42

spirea.net - http://spirea.net
andøya rocket range - http://www.rocketrange.no