Re: [Zope-dev] improving the utility and adapter lookup APIs

2009-11-30 Thread Brian Sutherland
On Wed, Nov 25, 2009 at 10:17:41PM +0100, Hanno Schlichting wrote: On Wed, Nov 25, 2009 at 9:52 PM, Tres Seaver tsea...@palladion.com wrote: Hmm, I may be missing something here, but if Foo implements IFoo, then the getAdapter lookup for it will short circuit, leading you into infinite

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martijn Faassen
Charlie Clark wrote: [snip] So adapters are reduced to type conversion? Adaptation is give me something that provides this API for this object. Conversion in Python asks the same. Adaption just formalizes this and generalizes it. I don't see how it's a reduction. Calling an interface is

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martijn Faassen
Chris McDonough wrote: Lennart Regebro wrote: I have very much come to appreciate the power of this delegation in, say, BrowserViews; even if it did take me several months to understand the multiadapter pattern! I hear this a lot, so this is apparently something that is common to take a

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martijn Faassen
Martin Aspeli wrote: Martijn Faassen wrote: Multi-adaptation: IFoo(one, two) Please note that this will break an incredible amount of code in the wild. A good number of my packages do something like this: foo = IFoo(context, None) if foo is None: ... Yes, that this

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martijn Faassen
Wolfgang Schnerring wrote: * Martijn Faassen faas...@startifact.com [2009-11-27 12:32]: Would people be okay with such an upgrade path? Any better ideas? Yes, I'm okay with it. I do think we should take care that the transition period is long enough, so that people have a chance to update

[Zope-dev] Zope Tests: 6 OK

2009-11-30 Thread Zope Tests Summarizer
Summary of messages to the zope-tests list. Period Sun Nov 29 12:00:00 2009 UTC to Mon Nov 30 12:00:00 2009 UTC. There were 6 messages: 6 from Zope Tests. Tests passed OK --- Subject: OK : Zope-2.10 Python-2.4.6 : Linux From: Zope Tests Date: Sun Nov 29 20:38:22 EST 2009 URL:

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martin Aspeli
Martijn Faassen wrote: Martin Aspeli wrote: Martijn Faassen wrote: Multi-adaptation: IFoo(one, two) Please note that this will break an incredible amount of code in the wild. A good number of my packages do something like this: foo = IFoo(context, None) if foo is None:

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Leonardo Rochael Almeida
I find it rather odd that we're wasting so much time worrying about backward incompatibility when we have a perfect mechanism to introduce backward incompatible changes in a way that allows both flavours to be used by packages in the same application (on a module by module basis just like Martijn

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martin Aspeli
Hanno Schlichting wrote: On Mon, Nov 30, 2009 at 1:21 PM, Martin Aspeli optilude+li...@gmail.com wrote: Martijn Faassen wrote: This implies we don't want to release zope.component 4.0 for a long time yet. I think the answer should be never. :) I think never is a rather long time. I'd

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Wichert Akkerman
On 11/30/09 13:43 , Hanno Schlichting wrote: On Mon, Nov 30, 2009 at 1:21 PM, Martin Aspelioptilude+li...@gmail.com wrote: Martijn Faassen wrote: This implies we don't want to release zope.component 4.0 for a long time yet. I think the answer should be never. :) I think never is a

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Hanno Schlichting
On Mon, Nov 30, 2009 at 2:39 PM, Wichert Akkerman wich...@wiggy.net wrote: We could also say that we will clean up the API when we move to Python 3. That is a natural breaking point anyway, so it will not any extra pain for users of the ZCA. Except that is precisely what the Python developers

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Wichert Akkerman
On 11/30/09 14:45 , Hanno Schlichting wrote: On Mon, Nov 30, 2009 at 2:39 PM, Wichert Akkermanwich...@wiggy.net wrote: We could also say that we will clean up the API when we move to Python 3. That is a natural breaking point anyway, so it will not any extra pain for users of the ZCA.

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Stephan Richter
On Friday 27 November 2009, Martijn Faassen wrote: Are people okay with the proposed semantics? Would people be okay with such an upgrade path? Any better ideas? Looks good. Note: We had Thanks Giving over the weekend, so please allow more US people, like Jim, to comment before finalizing

Re: [Zope-dev] improving the utility and adapter lookup APIs

2009-11-30 Thread Gary Poster
On Nov 30, 2009, at 4:05 AM, Brian Sutherland wrote: On Wed, Nov 25, 2009 at 10:17:41PM +0100, Hanno Schlichting wrote: On Wed, Nov 25, 2009 at 9:52 PM, Tres Seaver tsea...@palladion.com wrote: Hmm, I may be missing something here, but if Foo implements IFoo, then the getAdapter lookup for

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martin Aspeli
Hanno Schlichting wrote: On Mon, Nov 30, 2009 at 2:39 PM, Wichert Akkerman wich...@wiggy.net wrote: We could also say that we will clean up the API when we move to Python 3. That is a natural breaking point anyway, so it will not any extra pain for users of the ZCA. Except that is precisely

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Gary Poster
On Nov 27, 2009, at 6:32 AM, Martijn Faassen wrote: Hi there, Introduction So now that we've had some discussion and to exit the bikeshed phase, Wow. That's abrupt, for something at the root of the entire stack. I don't think long emails are very effective, but I'm not

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martijn Faassen
Martin Aspeli wrote: Martijn Faassen wrote: [snip] That's why I think it's important to have a: * a zope.component 3.x that supports both patterns * a per-module way to indicate whether the new API should be used. Sorry, I just don't buy it. The *moment* someone requires = 4.0, you're

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gary Poster wrote: On Nov 27, 2009, at 6:32 AM, Martijn Faassen wrote: Utility lookups versus adapter lookups -- There was some discussion on whether utility lookups are really something fundamentally

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martijn Faassen
Leonardo Rochael Almeida wrote: I find it rather odd that we're wasting so much time worrying about backward incompatibility when we have a perfect mechanism to introduce backward incompatible changes in a way that allows both flavours to be used by packages in the same application (on a

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Thomas Lotze
Lennart Regebro wrote: On Sat, Nov 28, 2009 at 16:39, Charlie Clark The most common example I know of the syntax is with INameChooser() which brings us back to the differences (real or imaginary) between utilities and adapters. I agree that calling an interface like that is a strange

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tres Seaver wrote: Gary Poster wrote: On Nov 27, 2009, at 6:32 AM, Martijn Faassen wrote: Utility lookups versus adapter lookups -- There was some discussion on whether utility lookups are really something

Re: [Zope-dev] Proposal: zope.app.publisher refactoring

2009-11-30 Thread Roger
Hi Michael I just implemented z3c.authviewlet and moved the authentication viewlet part from z3c.layer.pagelet into this new package. The z3c.layer.pagelet package does not use the z3c.authviewlet package as a dependency. This means you need to include the z3c.authviewlet package in your

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martijn Faassen
Stephan Richter wrote: On Friday 27 November 2009, Martijn Faassen wrote: Are people okay with the proposed semantics? Would people be okay with such an upgrade path? Any better ideas? Looks good. Note: We had Thanks Giving over the weekend, so please allow more US people, like Jim, to

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martijn Faassen
Hey, [Python 3 discussions] I think discussions about Python 3 and changing the API then should be tabled in this thread. We're talking about a timeline where the first steps will take place in the next few months. Realistic small steps, please. (just like we'll need realistic small steps

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Martijn Faassen wrote: Stephan Richter wrote: On Friday 27 November 2009, Martijn Faassen wrote: Are people okay with the proposed semantics? Would people be okay with such an upgrade path? Any better ideas? Looks good. Note: We had Thanks

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martijn Faassen
Hey, Wichert Akkerman wrote: [snip] We could also say that we will clean up the API when we move to Python 3. That is a natural breaking point anyway, so it will not any extra pain for users of the ZCA. In my opinion, that would be the absolute worst possible moment. Motivation:

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Stephan Richter
On Monday 30 November 2009, Martijn Faassen wrote: * we can then allow tuple adaptation again. :) Tuple adaption was also really important to the Twisted guys. We should consult them to see whether they are still using zope.component and whether they are still adapting tuples. Regards,

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Hanno Schlichting
On Mon, Nov 30, 2009 at 5:09 PM, Martijn Faassen faas...@startifact.com wrote: Leonardo Rochael Almeida wrote:  * Use a different package name! We don't have that option, as we're talking about changing the behavior of calling IFoo. It's very well possible. You create a new distribution

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martijn Faassen
Hey, Gary Poster wrote: On Nov 27, 2009, at 6:32 AM, Martijn Faassen wrote: [snip] So now that we've had some discussion and to exit the bikeshed phase, Wow. That's abrupt, for something at the root of the entire stack. I realize now that exiting the bikeshed phase was premature. Then

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martijn Faassen
Stephan Richter wrote: On Monday 30 November 2009, Martijn Faassen wrote: * we can then allow tuple adaptation again. :) Tuple adaption was also really important to the Twisted guys. We should consult them to see whether they are still using zope.component and whether they are still

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martijn Faassen
Tres Seaver wrote: [snip] Do we really have a significant codebase which both needs to adapt tuples *and* uses the interface-calling sugar? I hope not. That's why I walk all over it breaking backwards compatibility in this plan. We'd need to live with IFoo((a, b)) for a few years as opposed

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martijn Faassen
Hanno Schlichting wrote: On Mon, Nov 30, 2009 at 5:09 PM, Martijn Faassen faas...@startifact.com wrote: Leonardo Rochael Almeida wrote: * Use a different package name! We don't have that option, as we're talking about changing the behavior of calling IFoo. It's very well possible. You

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Gary Poster
On Nov 30, 2009, at 11:51 AM, Chris McDonough wrote: Tres Seaver wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gary Poster wrote: On Nov 27, 2009, at 6:32 AM, Martijn Faassen wrote: Utility lookups versus adapter lookups -- There was some

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Lennart Regebro
On Mon, Nov 30, 2009 at 08:40, Wolfgang Schnerring w...@gocept.com wrote: Thus, we should not start requiring zope.component 4.0 everywhere immediately (because it's new, great and shiny ;), but rather use 3.9+future when we want to use the new semantics, and only after I don't know, 6 months

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Shane Hathaway
Martijn Faassen wrote: Given some feedback about backwards compatibility, I'm leaning to the following adjusted scenario: * allow IFoo((a, b)) for multi adaptation. This breaks tuple adaptation. It's not as pretty as IFoo(a, b), but it's pretty tolerable and it *is* actually symmetric

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Lennart Regebro
On Mon, Nov 30, 2009 at 19:16, Shane Hathaway sh...@hathawaymix.org wrote: If adding lookup() is a good idea Possibly, but it sound like you are looking up (a), when in fact you are adapting it. :) Maye IFoo.adapt(a) ? -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Matthias Lehmann
Am Montag 30 November 2009 16:57:11 schrieb Gary Poster: As above, I disagree. As a matter of mechanics, when you register something we call an adapter, it is a callable that takes one or more arguments. If we were going to follow the pattern that Marius laid out to establish what

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Shane Hathaway
Lennart Regebro wrote: On Mon, Nov 30, 2009 at 19:16, Shane Hathaway sh...@hathawaymix.org wrote: If adding lookup() is a good idea Possibly, but it sound like you are looking up (a), when in fact you are adapting it. :) Maye IFoo.adapt(a) ? +1, IFoo.adapt() is better, along with

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Chris McDonough
Shane Hathaway wrote: Martijn Faassen wrote: Given some feedback about backwards compatibility, I'm leaning to the following adjusted scenario: * allow IFoo((a, b)) for multi adaptation. This breaks tuple adaptation. It's not as pretty as IFoo(a, b), but it's pretty tolerable and it *is*

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Gary Poster
On Nov 30, 2009, at 1:51 PM, Chris McDonough wrote: Shane Hathaway wrote: ...a good general argument, that Chris seemed to agree with and expand upon, and that has some merit to me. What do you think? + 1 with the following caveat: I think that method name should probably be adapt;

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Gary Poster
On Nov 30, 2009, at 11:47 AM, Martijn Faassen wrote: Hey, Gary Poster wrote: On Nov 27, 2009, at 6:32 AM, Martijn Faassen wrote: ...snipping here and elsewhere without further warning... Utility lookup: IFoo() Named utility lookup: IFoo(name=foo) Utility lookup with a

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Charlie Clark
Am 30.11.2009, 20:24 Uhr, schrieb Gary Poster gary.pos...@gmail.com: 1) I very much like the idea of some helpers hanging around. However, my current belief is that the factory methods ought to be callable objects that allow introspection of the underlying registry. That's where the

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Zvezdan Petkovic
On Nov 30, 2009, at 2:24 PM, Gary Poster wrote: 3) I also think that utility is a bad name. Is singleton two letters too long? Yes and not because singleton is longer. It just a bad name. :-) ___ Zope-Dev maillist - Zope-Dev@zope.org

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Zvezdan Petkovic
On Nov 30, 2009, at 4:05 PM, Zvezdan Petkovic wrote: On Nov 30, 2009, at 2:24 PM, Gary Poster wrote: 3) I also think that utility is a bad name. Is singleton two letters too long? Yes and not because singleton is longer. It just a bad name. :-) To clarify because of 1. the

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Gary Poster
On Nov 30, 2009, at 3:49 PM, Charlie Clark wrote: Am 30.11.2009, 20:24 Uhr, schrieb Gary Poster gary.pos...@gmail.com: 1) I very much like the idea of some helpers hanging around. However, my current belief is that the factory methods ought to be callable objects that allow

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Gary Poster
On Nov 30, 2009, at 4:13 PM, Zvezdan Petkovic wrote: On Nov 30, 2009, at 4:05 PM, Zvezdan Petkovic wrote: On Nov 30, 2009, at 2:24 PM, Gary Poster wrote: 3) I also think that utility is a bad name. Is singleton two letters too long? Yes and not because singleton is longer. It just

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Zvezdan Petkovic
On Nov 30, 2009, at 4:40 PM, Gary Poster wrote: Put yet another way, how are 99+% of our utility usages not singletons? Therein lies the problem. Singletons are singletons in 100% of cases. Since utilities are not singletons in 100% of cases they are not singletons by definition. If that's

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Fred Drake
On Mon, Nov 30, 2009 at 5:14 PM, Lennart Regebro rege...@gmail.com wrote: True. For me utilities are tools. Like CMFs portal_whatever. But in Zope3 even small stupid singleton objects are utilities in some cases, and that is confusing for a beginner. I wonder how many typical Python

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Shane Hathaway
Gary Poster wrote: Then to the multiadapter concern I raised, all my real-world examples of adapters are to adapt one object so it can be used in a certain way (to integrate with another kind of object). Power adapters, for instance, adapt a plug (required interface) so it can plugged in to

[Zope-dev] adapter vs factory Re: implementing zope.component 4.0

2009-11-30 Thread Gary Poster
On Nov 30, 2009, at 5:14 PM, Lennart Regebro wrote: On Mon, Nov 30, 2009 at 22:40, Gary Poster gary.pos...@gmail.com wrote: Then to the multiadapter concern I raised, all my real-world examples of adapters are to adapt one object so it can be used in a certain way (to integrate with

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martin Aspeli
Martijn Faassen wrote: The most elegant backwards compatible solution would be multi adaptation using a tuple. I think 'name' can probably also be added to the adapter hook without breaking stuff. People adapting tuples will need an explicit way to do so. It's still backwards incompatible,

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Martin Aspeli
Martijn Faassen wrote: Stephan Richter wrote: On Friday 27 November 2009, Martijn Faassen wrote: Are people okay with the proposed semantics? Would people be okay with such an upgrade path? Any better ideas? Looks good. Note: We had Thanks Giving over the weekend, so please allow more US

Re: [Zope-dev] implementing zope.component 4.0

2009-11-30 Thread Laurent Mignon
Gary Poster wrote: On Nov 30, 2009, at 3:49 PM, Charlie Clark wrote: Then to the multiadapter concern I raised, all my real-world examples of adapters are to adapt one object so it can be used in a certain way (to integrate with another kind of object). Power adapters, for instance, adapt