[Zope] External Method: Render STX with images

Steffen Hausmann Steffen.Hausmann@web.de
Sat, 22 Sep 2001 10:40:50 +0200


Hi,

> I'm putting this on the list because I've seen a couple of posts of other
people who wanted to have images in their stx documents. I've just uploaded
a python solution you can use as a simple way to provide this feature:
> You will only have to change your
> <dtml-var my_stx_input fmt=structured-text>
> to
> <dtml-var "stx_to_html(my_stx_input)">
> to use the extended rendering with images.

this doesn't somehow work properly on my system.
i am using zope 2.4.1 ( stable version ) and i hacked the
DocumentWithImages.py file as you descibed some topics before.

when i use a sting that shoulb be converted into structured text everything
goes fine, but when i try to hand over a document to your method the
following attribute error occurs:

Error Type: AttributeError
Error Value: expandtabs

Traceback (innermost last):
  File
/usr/local/ZopePark/Zope-2.4.1-linux2-x86/lib/python/ZPublisher/Publish.py,
line 223, in publish_module
  File
/usr/local/ZopePark/Zope-2.4.1-linux2-x86/lib/python/ZPublisher/Publish.py,
line 187, in publish
  File
/usr/local/ZopePark/Zope-2.4.1-linux2-x86/lib/python/Zope/__init__.py, line
226, in zpublisher_exception_hook
    (Object: LockableItem)
  File
/usr/local/ZopePark/Zope-2.4.1-linux2-x86/lib/python/ZPublisher/Publish.py,
line 171, in publish
  File
/usr/local/ZopePark/Zope-2.4.1-linux2-x86/lib/python/ZPublisher/mapply.py,
line 160, in mapply
    (Object: index_html)
  File
/usr/local/ZopePark/Zope-2.4.1-linux2-x86/lib/python/ZPublisher/Publish.py,
line 112, in call_object
    (Object: index_html)
  File
/usr/local/ZopePark/Zope-2.4.1-linux2-x86/lib/python/OFS/DTMLDocument.py,
line 199, in __call__
    (Object: index_html)
  File
/usr/local/ZopePark/Zope-2.4.1-linux2-x86/lib/python/DocumentTemplate/DT_Str
ing.py, line 546, in __call__
    (Object: index_html)
  File
/usr/local/ZopePark/Zope-2.4.1-linux2-x86/lib/python/DocumentTemplate/DT_Uti
l.py, line 231, in eval
    (Object: stx_to_html(stxdocdoc))
    (Info: stx_to_html)
  File <string>, line 2, in f
  File
/usr/local/ZopePark/Zope-2.4.1-linux2-x86/lib/python/Products/ExternalMethod
/ExternalMethod.py, line 274, in __call__
    (Object: stx_to_html)
    (Info: ((<DTMLDocument instance at 85adf30>,), {}, (1,)))
  File /usr/local/ZopePark/Zope-2.4.1-linux2-x86/Extensions/stx_to_html.py,
line 109, in stx_to_html
    (Object: stxdocdoc)
  File
/usr/local/ZopePark/Zope-2.4.1-linux2-x86/lib/python/StructuredText/ST.py,
line 113, in StructuredText
    (Object: stxdocdoc)
  File /usr/local/ZopePark/Zope-2.4.1-linux2-x86/lib/python2.1/string.py,
line 295, in expandtabs
    (Object: stxdocdoc)
AttributeError: (see above)

it would be very nice if you guys could take a look at it.

thanks anyhow.
  Steffen Hausmann