|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -# $Id: cgi_client.py,v 1.55 2001-11-07 02:34:06 jhermann Exp $ |
| 18 | +# $Id: cgi_client.py,v 1.56 2001-11-14 21:35:21 richard Exp $ |
19 | 19 |
|
20 | 20 | import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes |
21 | 21 | import binascii, Cookie, time |
@@ -424,6 +424,17 @@ def _post_editnode(self, nid, changes=None): |
424 | 424 | link = self.db.classes[link] |
425 | 425 | link.set(nodeid, **{property: nid}) |
426 | 426 |
|
| 427 | + # handle file attachments |
| 428 | + files = [] |
| 429 | + if self.form.has_key('__file'): |
| 430 | + file = self.form['__file'] |
| 431 | + type = mimetypes.guess_type(file.filename)[0] |
| 432 | + if not type: |
| 433 | + type = "application/octet-stream" |
| 434 | + # create the new file entry |
| 435 | + files.append(self.db.file.create(type=type, name=file.filename, |
| 436 | + content=file.file.read())) |
| 437 | + |
427 | 438 | # generate an edit message |
428 | 439 | # don't bother if there's no messages or nosy list |
429 | 440 | props = cl.getprops() |
@@ -481,7 +492,7 @@ def _post_editnode(self, nid, changes=None): |
481 | 492 | content=content) |
482 | 493 | messages = cl.get(nid, 'messages') |
483 | 494 | messages.append(message_id) |
484 | | - props = {'messages': messages} |
| 495 | + props = {'messages': messages, 'files': files} |
485 | 496 | cl.set(nid, **props) |
486 | 497 |
|
487 | 498 | def newnode(self, message=None): |
@@ -955,6 +966,9 @@ def parsePropsFromForm(db, cl, form, nodeid=0): |
955 | 966 |
|
956 | 967 | # |
957 | 968 | # $Log: not supported by cvs2svn $ |
| 969 | +# Revision 1.55 2001/11/07 02:34:06 jhermann |
| 970 | +# Handling of damaged login cookies |
| 971 | +# |
958 | 972 | # Revision 1.54 2001/11/07 01:16:12 richard |
959 | 973 | # Remove the '=' padding from cookie value so quoting isn't an issue. |
960 | 974 | # |
|
0 commit comments