[Zope-CMF] STX in python script

Tres Seaver tseaver@palladion.com
Tue, 31 Jul 2001 22:27:59 -0400


Adrian Madrid wrote:

> I need to transform a long bunch of articles (custom
> type) from structured text to their rendered html. I
> have created a python script to go through the
> collection of articles and transport the original STX
> from one field to another as HTML and but my problem
> is how to render the STX. How do you render STX in a
> python script?
> 
> Thanks in advance,


At the moment, you will need either to do this as an ExternalMethod,
or else add an alias and some module security declarations to
CMFCore.utils.py;  the issue is that the method, '_format_stx',
can't be called from TTW code unless it a) loses the leading underscore,
and b) gets "tagged" as safe for TTW code.

An ExternalMethod might look like:

   from Products.CMFCore.utils import _format_stx

   def format_stx( text, level=1 ):
       return _format_stx( text, level )

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com