[Zope] External Method Help - Rendered HTML to Disk
Small Business Services
toolkit at magma.ca
Tue Jan 20 09:08:42 EST 2004
Here are a few ideas that may help:
1) I would try putting all of the fields that you want to access in a dtml
method or python script as parameters in the html link to make it easier to
get at them:
eg.
http://my-zope-site/somefoler/write2FS?routine=index_html&filename=somepath%
2Fsomefile...
This way, in your method/script, you can refer to the variable 'routine' to
get 'index_html'.
2) Here is some dtml code to create a new dtml method using the 'routine'
variable from above:
<dtml-comment> create the content for the new dtml method </dtml-comment>
<dtml-call "REQUEST.set('dtmlcode', '<dtml-var
standard_html_header><dtml-var REQUEST><dtml-var standard_html_footer>')">
<dtml-comment> create the new method </dtml-comment>
<dtml-call "manage_addDTMLMethod(routine, 'newtitle')">
<dtml-comment> now put some content into the new dtml method </dtml-comment>
<dtml-call "_.getitem(routine).manage_edit(dtmlcode, 'newtitle2')">
<dtml-comment> now execute the new method </dtml-comment>
<dtml-var "_[routine]">
HTH
Jonathan
----- Original Message -----
From: "Samir Mishra" <SamirMishra at cbuae.gov.ae>
To: <zope at zope.org>
Sent: January 20, 2004 12:53 AM
Subject: [Zope] External Method Help - Rendered HTML to Disk
> Hello All,
>
> I'm experiencing a mental block on this, hoping someone can help with some
> pointers, resources to get me started on the right path.
>
> I'd like to have a generic DTML method (or preferably a python script),
call
> it write2FS, that can be called as, e.g.
>
>
http://my-zope-site//somefolder/index_html/write2FS?filename=somepath%2Fsome
> file
>
> and this will create a file called {ZOPEPATH}/var/somepath/somefile.html
> containing the rendered version of index_html. Optionally,
>
> 1. if a filename is not supplied to the method above, the script/method
will
> render & write index_html to file
{ZOPEPATH}/var/someFolder/index_html.html.
>
>
> 2. if the method is invoked as
>
http://my-zope-site//someFolder/index_html/write2FS?filename=somepath%2Fsome
> file&link=someOtherFolder%2FZopeObj it will write a file named
> {ZOPEPATH}/var/somepath/somefile.html containing the rendered elements of
> http://my-zope-site//someOtherFolder/ZopeObj
>
> I hope the above is intelligible.
>
> My motivation for the above is that I'm dealing with a lot of dynamic
> financial time series data, up to a point. Once the data is published,
e.g.
> at the end of a week/month, it is static. Therefore, instead of performing
a
> DB query each time a report is requested, I'd like to save the canned
> reports as static pages once data is published and have apache handle
them.
>
> Later, perhaps I'll consider saving the reports in a DB as text BLOBs.
>
> Thanks in advance.
>
> Samir.
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
More information about the Zope
mailing list