Re: [Zope3-dev] Re: zope.filerepresentation.interfaces.IWriteFile

2006-09-29 Thread Philipp von Weitershausen

Benji York wrote:

Christian Theune wrote:

We probably have to. But to be honest? I totally understand every
programmer that will ask us "WTF?!?". Does anybody see a better way out
of that situation without deprecating anything again?


I don't.  As far as I can tell, this is a deceptive API and looks like a 
perfect candidate for deprecation.


+1 for a better replacement. I think something that can work with 
iterables would be much better. It'd make it a lot easier to couple with 
WSGI, for example.

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: zope.filerepresentation.interfaces.IWriteFile

2006-09-29 Thread Gary Poster


On Sep 29, 2006, at 5:08 PM, Luis De la Parra wrote:


then we have z3c.filetype and zope.mimetype. For what I've seen,
z3c.filetype is in a better shape, but both of them seem to be  
similar.


I'm not familiar with z3c.filetype.  Could you (or someone else)  
elaborate on the similarities, and why z3c.filetype is in better shape?


Thanks

Gary
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Re: zope.filerepresentation.interfaces.IWriteFile

2006-09-29 Thread Luis De la Parra

>> There is an interface called IWriteFile in the module
>> zope.filerepresentation.interfaces.
>> 
>> It defines one method "write(data)" with the doc string:
>> 
>> "Update the file data"
>> 
>> There are some problems I have with this:
>> 
>> a) The interface is yet another interface for doing a file-like object.
>> How many of those are around?
> 
> Oh, which others are there?
> 
>> b) It *seems intended* not to be really file-like but that "update the
>> file data" means: writing to this will replace all previous data

b)
writing to a file without first seeking to the end will replace its contents
(in 'w-rite' mode), so I think all applications currently just "opening"
(adapting) to IWriteFile and writing to it will still work if this
is "fixed" to be like a real file

a)well.. while not exactly the same, I think these 3 are (should be)
similar: 

zope.app.file
zope.file 
z3c.extfile

it might be a good idea to try to unify these and get a good "file"-like
object in the zope core which everyone can use.

maybe a first step would be to include zope.file in the default
distribution, and replace all zope.app.file usage with it, since zope.file
seems to be a super set of zope.app.file (in sense functionality) and more
like a real file, and as a second step you might replace z3c.extfile with
zope.file with a blob-enabled zodb

then we have z3c.filetype and zope.mimetype. For what I've seen,
z3c.filetype is in a better shape, but both of them seem to be similar.
so you could unify them as well and then replace zope.app.file.image with a
zope.file plus the image interface from filetype/mimetype 

regards.
luis


___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: zope.filerepresentation.interfaces.IWriteFile

2006-09-29 Thread Benji York

Christian Theune wrote:

We probably have to. But to be honest? I totally understand every
programmer that will ask us "WTF?!?". Does anybody see a better way out
of that situation without deprecating anything again?


I don't.  As far as I can tell, this is a deceptive API and looks like a 
perfect candidate for deprecation.

--
Benji York
Senior Software Engineer
Zope Corporation
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: zope.filerepresentation.interfaces.IWriteFile

2006-09-29 Thread Ignas Mikalajunas

Philipp von Weitershausen wrote:
> Christian Theune wrote:
>> Hi,
>>
>> as I stumbled over this recently, I'd like to bring this up for
>> discussion:
>>
>> There is an interface called IWriteFile in the module
>> zope.filerepresentation.interfaces.
>>
>> It defines one method "write(data)" with the doc string:
>>
>> "Update the file data"
>>
>> There are some problems I have with this:
>>
>> a) The interface is yet another interface for doing a file-like object.
>> How many of those are around?
>
> Oh, which others are there?

Humm. Looks like it's only that one =).

>> b) It *seems intended* not to be really file-like but that "update the
>> file data" means: writing to this will replace all previous data
>
> Yes.

Too bad. :/

>> c) The doc string is IMHO underspecified (I asked 3 other developers in
>> the office. One of them said "it will replace the data on the second
>> call", one said "it will append data like the file object", the third
>> wasn't sure but was in favor of appending data)
>>
>> This interface is used only in very few places in Zope.
>
> FTP and HTTP PUT.

Yup. That's what I saw.

>> I'm not sure what to do now, but I think something needs to be changed.
>> Here are some options:
>>
>> - Make the doc string more explicit. (That should happen anyway)
>> - Keep the current behavior.
>
> I think we'll have to :(. There have been lots of documented uses of
> filerepresentation
>
>> - Change the current behavior and make write() act like Python's
>>   file.write()
>
> Perhaps in a new interface?

We probably have to. But to be honest? I totally understand every
programmer that will ask us "WTF?!?". Does anybody see a better way out
of that situation without deprecating anything again?

Christian


SchoolTool is using this infrastructure for it's RESTive views. And
yes the interface could get improved a bit. The file.write() method
could be more simmilar to IFileFactory.__call__ as else one has to
assume that updates to a file are not going to change the encoding as
the encoding from an HTTP PUT request is ignored (which got us a few
times when users were uploading ICal ics files with a different
encoding so we had to work around it with a custom view for updates).

Ignas
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: zope.filerepresentation.interfaces.IWriteFile

2006-09-29 Thread Christian Theune
Philipp von Weitershausen wrote:
> Christian Theune wrote:
>> Hi,
>>
>> as I stumbled over this recently, I'd like to bring this up for
>> discussion:
>>
>> There is an interface called IWriteFile in the module
>> zope.filerepresentation.interfaces.
>>
>> It defines one method "write(data)" with the doc string:
>>
>> "Update the file data"
>>
>> There are some problems I have with this:
>>
>> a) The interface is yet another interface for doing a file-like object.
>> How many of those are around?
> 
> Oh, which others are there?

Humm. Looks like it's only that one =).

>> b) It *seems intended* not to be really file-like but that "update the
>> file data" means: writing to this will replace all previous data
> 
> Yes.

Too bad. :/

>> c) The doc string is IMHO underspecified (I asked 3 other developers in
>> the office. One of them said "it will replace the data on the second
>> call", one said "it will append data like the file object", the third
>> wasn't sure but was in favor of appending data)
>>
>> This interface is used only in very few places in Zope.
> 
> FTP and HTTP PUT.

Yup. That's what I saw.

>> I'm not sure what to do now, but I think something needs to be changed.
>> Here are some options:
>>
>> - Make the doc string more explicit. (That should happen anyway)
>> - Keep the current behavior.
> 
> I think we'll have to :(. There have been lots of documented uses of
> filerepresentation
> 
>> - Change the current behavior and make write() act like Python's
>>   file.write()
> 
> Perhaps in a new interface?

We probably have to. But to be honest? I totally understand every
programmer that will ask us "WTF?!?". Does anybody see a better way out
of that situation without deprecating anything again?

Christian

-- 
gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development




signature.asc
Description: OpenPGP digital signature
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



[Zope3-dev] Re: zope.filerepresentation.interfaces.IWriteFile

2006-09-29 Thread Philipp von Weitershausen

Christian Theune wrote:

Hi,

as I stumbled over this recently, I'd like to bring this up for discussion:

There is an interface called IWriteFile in the module
zope.filerepresentation.interfaces.

It defines one method "write(data)" with the doc string:

"Update the file data"

There are some problems I have with this:

a) The interface is yet another interface for doing a file-like object.
How many of those are around?


Oh, which others are there?


b) It *seems intended* not to be really file-like but that "update the
file data" means: writing to this will replace all previous data


Yes.


c) The doc string is IMHO underspecified (I asked 3 other developers in
the office. One of them said "it will replace the data on the second
call", one said "it will append data like the file object", the third
wasn't sure but was in favor of appending data)

This interface is used only in very few places in Zope.


FTP and HTTP PUT.


I'm not sure what to do now, but I think something needs to be changed.
Here are some options:

- Make the doc string more explicit. (That should happen anyway)
- Keep the current behavior.


I think we'll have to :(. There have been lots of documented uses of 
filerepresentation



- Change the current behavior and make write() act like Python's
  file.write()


Perhaps in a new interface?

___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com