Add sections on file uploading and on the Publishe ... (quixote/doc/upgrading.txt)
Andrew Kuchling <akuchlin-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Tue, 31 Dec 2002 15:06:53 -0500
| Newsgroups | gmane.comp.web.quixote.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /home/cvs/quixote/doc In directory hewson:/tmp/cvs-serv11222 Modified Files: upgrading.txt Log Message: Add sections on file uploading and on the Publisher class Index: upgrading.txt =================================================================== RCS file: /home/cvs/quixote/doc/upgrading.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- upgrading.txt 31 Dec 2002 19:35:40 -0000 1.1 +++ upgrading.txt 31 Dec 2002 20:06:50 -0000 1.2 @@ -6,6 +6,60 @@ version. +Changes from 0.5 to 0.6 +----------------------- + +File Upload Changes +******************* + +Quixote 0.6 introduces new support for HTTP upload requests. Any HTTP +request with a Content-Type of "multipart/form-data" -- which is +generally only used for uploads -- is now represented by +HTTPUploadRequest, a subclass of HTTPRequest, and the uploaded files +themselves are represented by Upload objects. + +Whenever an HTTP request has a Content-Type of "multipart/form-data", +an instance of HTTPUploadRequest is created instead of HTTPRequest. +Some of the fields in the request are presumably uploaded files and +might be quite large, so HTTPUploadRequest will read all of the fields +supplied in the request body and write them out to temporary files; +the temporary files are written in the directory specified by the +UPLOAD_DIR configuration variable. + +Once the temporary files have been written, the HTTPUploadRequest +object is passed to a function or PTL template, just like an ordinary +request. The difference between HTTPRequest and HTTPUploadRequest +is that all of the form variables are represented as Upload objects. +Upload objects have three attributes: + +``orig_filename`` + the filename supplied by the browser. +``base_filename`` + a stripped-down version of orig_filename with unsafe characters removed. + This could be used when writing uploaded data to a permanent location. +``tmp_filename`` + the path of the temporary file containing the uploaded data for this field. + +Consult upload.txt for more information about handling file uploads. + + +Refactored `Publisher` Class +**************************** + +Various methods in the `Publisher` class were rearranged. If your +application subclasses Publisher, you may need to change your code +accordingly. + + * ``parse_request()`` no longer creates the HTTPRequest object; + instead a new method, ``create_request()``, handles this, + and can be overridden as required. + + As a result, the method signature has changed from + ``parse_request(stdin, env)`` to ``parse_request(request)``. + + * The ``Publisher.publish()`` method now catches exceptions raised + by ``parse_request()``. + Changes from 0.4 to 0.5 -----------------------