[Checkins] Re: [Zope3-checkins] SVN: Zope3/trunk/src/zope/app/http/ Conform to RFC2616 for PUT requests by returning a Location-header.

Gary Poster gary at zope.com
Thu Sep 28 17:31:35 EDT 2006


On Sep 28, 2006, at 1:51 PM, Marius Gedminas wrote:

> On Thu, Sep 28, 2006 at 04:25:54AM -0400, Wolfgang Schnerring wrote:
>> Log message for revision 70412:
>>   Conform to RFC2616 for PUT requests by returning a Location-header.
>>
>>   This is a merge from branches/ctheune-issue-125, rev. 70404-70411.
>>

...

> Ouch!  This change broke HTTP PUT for an application I'm working on.
>
> The IWriteFile adapter for ZPTPage assumes ``write`` will be called
> only once, and overwrites the contents on each call:
>
>   # src/zope/app/zptpage/zptpage.py
>   class ZPTWriteFile(object):
>
>       implements(IWriteFile)
>
>       def __init__(self, context):
>           self.context = context
>
>       def write(self, data):
>           # We cannot communicate an encoding via FTP. Zope's  
> default is UTF-8,
>           # so use it.
>           self.context.setSource(data.decode('UTF-8'), None)
>
> as a result only the last 64-byte chunk gets written.
>
> The interface description is not very clear:
>
>   class IWriteFile(Interface):
>
>       def write(data):
>           """Update the file data
>           """
>
> but my reading of it is that each write() is supposed to completely
> replace the existing file data, especially when you consider it in
> context (IReadFile.read() returns the whole file data).
>
> Please revert this part of your change.

Christian/Wolfgang, could you reply?  I'm afraid I haven't looked at  
the change, but I do see the error.  Could you revert, or  
compellingly argue why not? :-)

Thanks

Gary


More information about the Zope3-Checkins mailing list