[Zope] Showing html files

peter sabaini sabaini@inode.at
Tue, 16 Jul 2002 13:39:17 +0200


you acquire it from context --

my_object = getattr(context, 'my_object_id')

and then print the result of calling it or print it directly (depends on 
type, for more information look into the API-Reference or the source)

if the object is a DTMLMethod you should call it like this (from a 
PythonScript):

html = my_object(client=context, REQUEST=context.REQUEST)

again, check the API Reference for more on this (module DTMLMethod)


andre wrote:
> Thank's alot, but how do i include a DTML-document object for printing in 
> python??
> 
> Jens
> 
> Citat peter sabaini <sabaini@inode.at>:
> 
> 
>>hmm... if your files are NOT complete html files but rather fragments 
>>(ie. without leading &lt;html&gt; &lt;/html&gt; tags etc.) then thats 
>>easy -- one possibility would be something like the script below 
>>(uncomment according to your needs). this should be called like for 
>>instance:
>>
>>href="folder_your_files_are_in/embed_py?id=filename_in_folder"
>>
>>## Script (Python) "embed_py"
>>##bind container=container
>>##bind context=context
>>##bind namespace=
>>##bind script=script
>>##bind subpath=traverse_subpath
>>##parameters=id
>>##title=
>>print "<html>header"      # or include another zope object
>>o = getattr(context, id)
>># if the files are dtml methods call them:
>># print o(client=context, REQUEST=context.REQUEST)
>># else just print:
>># print o
>>print "\nfooter</html>"
>>return printed
>>
>>if your html files are complete you should strip the html header etc. 
>>out before prepending your own header
>>
>>hth peter.
>>
>>andre wrote:
>>
>>>Hi
>>>
>>> 
>>>
>>>I'm quite new to zope, and have a little question. I have some html
>>
>>files in 
>>
>>>different sub-folders I want to show. In the parent folder I have made
>>
>>a 
>>
>>>index_html to show a list of the files. The thing is that I want to
>>
>>show them 
>>
>>>including a header and a footer. I can't change the html-files, and
>>
>>the files 
>>
>>>is uploaded by users, so it has to be a dynamic solution. I hope
>>
>>someone can 
>>
>>>help me.
>>>
>>> 
>>>
>>>Thank's in advance
>>>
>>> 
>>>
>>>Jens Bjerre
>>>
>>>
>>>_______________________________________________
>>>Zope maillist  -  Zope@zope.org
>>>http://lists.zope.org/mailman/listinfo/zope
>>>**   No cross posts or HTML encoding!  **
>>>(Related lists - 
>>> http://lists.zope.org/mailman/listinfo/zope-announce
>>> http://lists.zope.org/mailman/listinfo/zope-dev )
>>>
>>>
>>
>>
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 
>