[Zope] Using page templates to generate large XML files

Andreas Jung lists at zopyx.com
Sat Sep 6 15:21:57 EDT 2008



--On 6. September 2008 20:34:21 +0200 Dieter Maurer <dieter at handshake.de> 
wrote:

> Marco Bizzarri wrote at 2008-9-6 08:26 +0200:
>> I need to generate a large XML file inside a Zope application; the
>> file is for backup purposes, so it is stored on the server and can be
>> downloaded later with whatever suitable tool.
>>
>> The data are taken from a database, and then they are used to create
>> the XML. I assume there will be between 40.000 and 100.000 rows to be
>> dumped.
>>
>> I thought i could use page template for this purpose, but I'm not sure
>> if it is possible to send the output from a pt to a file, directly.
>
> I fear, this is not a supported usecase:
>
>   The standard page template implementation writes to a
>   "StringIO" object (thus its internal infrastructure is prepared
>   for incremental output generation)
>   but the file to be written to it not controllable from outside.

Of course you can write the rendered result to a file. However the 
construction will occur in memory and might require lots of memory.
No idea about the structure and the complexity of the XML document....
generating it through Python is very likely faster and will requires less 
resources.

-aj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20080906/14514968/attachment.bin 


More information about the Zope mailing list