Re: [Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-30 Thread Chris Withers
Dieter Maurer wrote: The str example shows also that it is not sensible that the adapter registry framework gives the adapter (factory) a way to determine its name (str has nothing where the name could be sticked in). True enough, I guess I'll just have to stick with my hack or Tres' currying

Re: [Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-29 Thread Wichert Akkerman
Previously Chris Withers wrote: Really? Certainly in Zope 2, prettymuch every persistent objects needs to be getId()'able... The fact that something is true in Zope 3 does not necessarily make it a good idea. Wichert. -- Wichert Akkerman [EMAIL PROTECTED]It is simple to make things.

Re: [Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-29 Thread Stephan Richter
On Wednesday 29 November 2006 03:37, Wichert Akkerman wrote: The fact that something is true in Zope 3 does not necessarily make it a good idea. But the chances are pretty high! ;-) Regards, Stephan -- Stephan Richter CBU Physics Chemistry (B.S.) / Tufts Physics (Ph.D. student) Web2k - Web

Re: [Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-29 Thread Wichert Akkerman
Previously Stephan Richter wrote: On Wednesday 29 November 2006 03:37, Wichert Akkerman wrote: The fact that something is true in Zope 3 does not necessarily make it a good idea. But the chances are pretty high! ;-) Of course I meant to say 'Zope 2' there, which does reduce the chances.

Re: [Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-29 Thread Dieter Maurer
Chris Withers wrote at 2006-11-28 18:09 +: Benji York wrote: Chris Withers wrote: I don't think it'll be a common pattern, but it doesn't feel right to me that a named adapter (ie: one registered with a specific name) has no way of finding out what name it has been registered with...

Re: [Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-28 Thread Chris Withers
Benji York wrote: Chris Withers wrote: I don't think it'll be a common pattern, but it doesn't feel right to me that a named adapter (ie: one registered with a specific name) has no way of finding out what name it has been registered with... Because the same adapter can be registered more

[Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-28 Thread Chris Withers
Tres Seaver wrote: for name in ('vindaloo', 'madras', 'tiki_masala'): globals()[name] = MNA_factory_maker(name) and then in ZCML: adapter for=.interfaces.IChicken provides=.interfaces.ICurry name=vindaloo factory=.adapters.vindaloo / ...but

Re: [Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-28 Thread Benji York
Chris Withers wrote: Benji York wrote: Chris Withers wrote: I don't think it'll be a common pattern, but it doesn't feel right to me that a named adapter (ie: one registered with a specific name) has no way of finding out what name it has been registered with... Because the same adapter can

Re: [Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-28 Thread Paul Winkler
On Tue, Nov 28, 2006 at 06:12:19PM +, Chris Withers wrote: Is there a python-only way to register adapters instead of in ZCML and, if it exists, is it safe to use in conjunction with the normal zcml dances? There's always a way :) You could just do what the directive does - call the

[Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-28 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Benji York wrote: Chris Withers wrote: Benji York wrote: Chris Withers wrote: I don't think it'll be a common pattern, but it doesn't feel right to me that a named adapter (ie: one registered with a specific name) has no way of finding out

Re: [Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-27 Thread Chris Withers
Stephan Richter wrote: On Friday 17 November 2006 03:43, Chris Withers wrote: What do you suggest I do when the adapter needs to know the name it was registered for? You can make the name part of the adapter API. Not sure what you mean by this? However, I would suggest revising the design;

Re: [Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-27 Thread Benji York
Chris Withers wrote: I don't think it'll be a common pattern, but it doesn't feel right to me that a named adapter (ie: one registered with a specific name) has no way of finding out what name it has been registered with... Because the same adapter can be registered more than once, it would

Re: [Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-27 Thread Stephan Richter
On Monday 27 November 2006 11:17, Benji York wrote: This seems somewhat analogous to a Python object being given multiple names.  In that case too, there is no way for the object to know what it's names are. Great analogy. I used that one before too, but did not think of it this time.

[Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-27 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chris Withers wrote: Stephan Richter wrote: On Friday 17 November 2006 03:43, Chris Withers wrote: What do you suggest I do when the adapter needs to know the name it was registered for? You can make the name part of the adapter API. Not sure

Re: [Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-25 Thread Stephan Richter
On Friday 17 November 2006 03:43, Chris Withers wrote: What do you suggest I do when the adapter needs to know the name it was registered for? You can make the name part of the adapter API. However, I would suggest revising the design; I have never come across a scenario where I wanted the

Re: [Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-17 Thread Philipp von Weitershausen
Chris Withers wrote: Philipp von Weitershausen wrote: Chris Withers wrote: Can a named adapter find out the name it was registered with during the adaptation process? Nope. I can see why it's that way, but it seems a shame and maybe even an oversight :-/ What do you suggest I do when

[Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-16 Thread Philipp von Weitershausen
Chris Withers wrote: Can a named adapter find out the name it was registered with during the adaptation process? Nope. -- http://worldcookery.com -- Professional Zope documentation and training ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub:

[Zope3-dev] Re: Can an adapter find out what name it was registered for?

2006-11-16 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Philipp von Weitershausen wrote: Chris Withers wrote: Can a named adapter find out the name it was registered with during the adaptation process? Nope. But you can create the adapter factories in such a way that they know that name, via a