[Zope] ZDiscussions

Pearson, Brian Edward (GEA, 056278) BRIAN.PEARSON@APPL.GE.COM
Thu, 16 Mar 2000 14:33:22 -0500


All,

Have been trying to add File Attachment functionality to the ZDiscussions
Product.  Thus far, I have modded the ZDiscussions.py file, specifically the
ZDItem class's __init__ method, to accept one extra parameter called file.
The corresponding DTML-Method (postForm) within the ZDiscussion object has
been modded to include a FILE input field.

To facilitate the file handling, I am using the Squishfile.py module.  All
is working well, and via a new def attachment(self) method that was added to
the ZDiscussion.py module, I am able to return the file to the browser.

Herein lies the problem.  How can I reference the file via an HREF?  With
the following DTML:

<dtml-if attachment> 
	<b>Hello there</B>
	<tr><th bgcolor="#d0d0f0" align=left>Attachment:</th><td>
	<dtml-in attachment>		
		<A HREF="./<dtml-var file_name url_quote>">  
		<IMG SRC="<dtml-var SCRIPT_NAME >/<dtml-var icon >"
HEIGHT=16  
		  WIDTH=16 BORDER="0" ALT="Click to download
attachment"></A>    
		<A HREF="./<dtml-var file_name url_quote>">  
		<dtml-var file_name></A>   
		<dtml-var file_kbytes>KB (<dtml-var file_bytes> bytes)<BR>  
	</dtml-in attachment></td>
</dtml-if>

This of course references the file object as
absolute_url/ZDItem_id/file_name.  This same reference url is used in the
Squishdot product when displaying a link the user may click on to download
the file.  However, in my implementation it is not referencing the file.

The only way to reference the file is to use <dtml-var attachment>, which
means that the file will be streamed to the user as soon as they click on
the message thread, obviously not the way I would like to handle the
situation.

Do I need to include the file object as a property of the message?  I
thought by including the file object during the creation (__init__) method
of ZDItem this would be handled.

Any/all assistance would be greatly appreciated.  Also, if I am crazy for
doing this please let me know.  Perhaps a new ZDiscussion already exists
that supports attachments?

Thanks again,
-Brian