I ran into this same problem and discovered that some fields
have a
.replace method. E.g.
something.Description().replace('<p>',''). That
was good enough for what I wanted. Not sure if it works for
the body
text.
Peter Shute
plone-users-bounces lists.sourceforge.net wrote on :
> I'm attempting to use the following script to remove a
> specific pagination code from a Document's body text:
>
> ----------
>
> ## Script (Python) "removePagination"
> ##bind container=container
> ##bind context=context
> ##bind namespace=
> ##bind script=script
> ##bind subpath=traverse_subpath
> ##parameters=text=None
> ##title=Remove pagination code from a Page
>
> import re
>
> pagination =
re.compile('<p>++++*.</p>',
> re.IGNORECASE|re.DOTALL|re.LOCALE)
> pages = re.sub(pagination, '', text)
> ----------
>
> However, when I attempt to call this from my page
template I get the
> following error:
>
> Unauthorized: You are not allowed to access 'compile'
in
> this context.
>
> I'm assuming that this is due a security restriction.
How do
> I go about allowing a python script to use regular
> expressions from within Zope? Specifically I need to
somehow
> declare w/in my product that it's OK to use
re.compile,
> re.sub, etc in the manner that I'm using above. Or is
there
> a better way to do this?
>
> Any help would be appreciated. Thanks!
>
> Shane
>
>
------------------------------------------------------------
--
> -----------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get
the
> chance to share your opinions on IT & business
topics through brief
> surveys-and earn cash
> http://www.techsay.com/default.php?page=join.p
hp&p=sourceforge
&CID=DEVDEV
_______________________________________________
Plone-Users mailing list
Plone-Users lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plone-users
------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Plone-Users mailing list
Plone-Users lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plone-users
|