diff roundup/cgi_client.py @ 390:a74ea8489896

users may attach files to issues (and support in ext) through the web now
author Richard Jones <richard@users.sourceforge.net>
date Wed, 14 Nov 2001 21:35:22 +0000
parents 5088ff58d6e6
children 399340646765
line wrap: on
line diff
--- a/roundup/cgi_client.py	Tue Nov 13 21:44:44 2001 +0000
+++ b/roundup/cgi_client.py	Wed Nov 14 21:35:22 2001 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: cgi_client.py,v 1.55 2001-11-07 02:34:06 jhermann Exp $
+# $Id: cgi_client.py,v 1.56 2001-11-14 21:35:21 richard Exp $
 
 import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes
 import binascii, Cookie, time
@@ -424,6 +424,17 @@
                     link = self.db.classes[link]
                     link.set(nodeid, **{property: nid})
 
+        # handle file attachments
+        files = []
+        if self.form.has_key('__file'):
+            file = self.form['__file']
+            type = mimetypes.guess_type(file.filename)[0]
+            if not type:
+                type = "application/octet-stream"
+            # create the new file entry
+            files.append(self.db.file.create(type=type, name=file.filename,
+                content=file.file.read()))
+
         # generate an edit message
         # don't bother if there's no messages or nosy list 
         props = cl.getprops()
@@ -481,7 +492,7 @@
                 content=content)
             messages = cl.get(nid, 'messages')
             messages.append(message_id)
-            props = {'messages': messages}
+            props = {'messages': messages, 'files': files}
             cl.set(nid, **props)
 
     def newnode(self, message=None):
@@ -955,6 +966,9 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.55  2001/11/07 02:34:06  jhermann
+# Handling of damaged login cookies
+#
 # Revision 1.54  2001/11/07 01:16:12  richard
 # Remove the '=' padding from cookie value so quoting isn't an issue.
 #

Roundup Issue Tracker: http://roundup-tracker.org/