[Zope-CMF] printing archetypes imageField

J. Cameron Cooper jccooper at jcameroncooper.com
Mon Jan 12 19:13:02 EST 2004


mulamba kamahunda wrote:

>How can i do if i want to generate an html page from a
>python script?
>is there a way to do something like that?
>image1 = object.getImage1()
>
>page =..."<p><font
>size=\"+1\"><b>somethinh</b></font>\n"+image1+"></p>"
>print page
>return printed
>
You may be able to do 'image1()', but I don't recall exactly the call 
behaviour under these circumstances.

If that doesn't work, the image object (the Archetypes image field 
eventually has as its base the Zope Image object) provides a 'tag' 
method to do just this. This is also aliased to '__str__' and maybe 
'index_html'.

But: I don't recommend you do this. This is display, and Python scripts 
should stay out of it. Use something designed for templating instead, 
like ZPT.

          --jcc

-- 
"My point and period will be throughly wrought,
Or well or ill, as this day's battle's fought."





More information about the Zope-CMF mailing list