Skip to content

Commit c036413

Browse files
author
Gordon B. McMillan
committed
Allow form to set user-properties on a Fileclass.
Don't assume that a Fileclass is named "files".
1 parent 2ed28ac commit c036413

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

roundup/cgi_client.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: cgi_client.py,v 1.127 2002-06-11 06:38:24 richard Exp $
18+
# $Id: cgi_client.py,v 1.128 2002-06-12 21:28:25 gmcm Exp $
1919

2020
__doc__ = """
2121
WWW request handler (also used in the stand-alone server).
@@ -833,6 +833,7 @@ def newfile(self, message=None):
833833
'''
834834
cn = self.classname
835835
cl = self.db.classes[cn]
836+
props = parsePropsFromForm(self.db, cl, self.form)
836837

837838
# possibly perform a create
838839
keys = self.form.keys()
@@ -843,8 +844,10 @@ def newfile(self, message=None):
843844
if not mime_type:
844845
mime_type = "application/octet-stream"
845846
# save the file
846-
nid = cl.create(content=file.file.read(), type=mime_type,
847-
name=file.filename)
847+
props['type'] = mime_type
848+
props['name'] = file.filename
849+
props['content'] = file.file.read()
850+
nid = cl.create(**props)
848851
# handle linked nodes
849852
self._post_editnode(nid)
850853
# and some nice feedback for the user
@@ -925,7 +928,7 @@ def showfile(self):
925928
''' display a file
926929
'''
927930
nodeid = self.nodeid
928-
cl = self.db.file
931+
cl = self.db.classes[self.classname]
929932
mime_type = cl.get(nodeid, 'type')
930933
if mime_type == 'message/rfc822':
931934
mime_type = 'text/plain'
@@ -1363,6 +1366,9 @@ def parsePropsFromForm(db, cl, form, nodeid=0):
13631366

13641367
#
13651368
# $Log: not supported by cvs2svn $
1369+
# Revision 1.127 2002/06/11 06:38:24 richard
1370+
# . #565996 ] The "Attach a File to this Issue" fails
1371+
#
13661372
# Revision 1.126 2002/05/29 01:16:17 richard
13671373
# Sorry about this huge checkin! It's fixing a lot of related stuff in one go
13681374
# though.

0 commit comments

Comments
 (0)