Re: [Zope3-dev] Re: adapter registration question

2006-11-23 Thread Chris Withers
Raphael Ritz wrote: Chris Withers schrieb: Tres Seaver wrote: [..] ...and yet it works fine in Zope 2.9.4 :-S The first 'provideAdapter' call raises an exeption because 'str' doesn't have an '__iro__'. I don't even know what an __iro__ is :-S Interface Resolution Order - I think at l

Re: [Zope3-dev] Re: adapter registration question

2006-11-17 Thread Chris Withers
Dieter Maurer wrote: As Chris example demonstrates, it would have been better to call "IZopeDublinCore(myobj)" the "IZopeDublinCore" adaptation of "myobj". Agreed, and would have saved me a lot of confusion. cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting

Re: [Zope3-dev] Re: adapter registration question

2006-11-16 Thread Dieter Maurer
Jean-Marc Orliaguet wrote at 2006-11-15 20:51 +0100: > ... >but what problem is all this supposed to solve? are you guys writing a >PhD or something .-) ? Well chosen terminology is a key to understanding. Therefore, it is justified to discuss about it. -- Dieter __

Re: [Zope3-dev] Re: adapter registration question

2006-11-16 Thread Dieter Maurer
Philipp von Weitershausen wrote at 2006-11-15 21:11 +0100: > ... >Not sure what "official" terminology glossary you're basing this on I am basing this on the meaning of english words. An adapter is something that adapts (and not something that is adapted). "adapt" is a transitive verb. It applie

Re: [Zope3-dev] Re: adapter registration question

2006-11-16 Thread Philipp von Weitershausen
Chris Withers wrote: Philipp von Weitershausen wrote: Not sure what "official" terminology glossary you're basing this on, but we often refer to "IZopeDublinCore(myobj)" as the "IZopeDublinCore adapter" of myobj". Whatever is called to instantiate that object we call the "adapter factory" or

Re: [Zope3-dev] Re: adapter registration question

2006-11-16 Thread Chris Withers
Jean-Marc Orliaguet wrote: once you have that utility / adapter you should be able to call it like: converter = getAdapterFor(123, type=IToStringConverter) strResult = converter.convert(123) Not quite, what I'm looking to do is more along the lines of: mystr = getAdapter(123,str) (where

Re: [Zope3-dev] Re: adapter registration question

2006-11-16 Thread Chris Withers
Philipp von Weitershausen wrote: >>> IZopeDublinCore(obj) is a flexible version of >>> ZDCAnnotatableAdapter(obj) Flexible, because a different implementation that ZDCAnnotatableAdapter might be used. That's dispatched through the adapter registry. Right, exactly. IZopeDublinCore(myobj

Re: [Zope3-dev] Re: adapter registration question

2006-11-16 Thread Chris Withers
Philipp von Weitershausen wrote: Not sure what "official" terminology glossary you're basing this on, but we often refer to "IZopeDublinCore(myobj)" as the "IZopeDublinCore adapter" of myobj". Whatever is called to instantiate that object we call the "adapter factory" or "adapter implementatio

Re: [Zope3-dev] Re: adapter registration question

2006-11-15 Thread Philipp von Weitershausen
Jean-Marc Orliaguet wrote: str(123) has the same syntax as IZopeDublinCore(myobj), but semantically there is nothing in common between the two expressions. I disagree. >>> IZopeDublinCore(obj) is a flexible version of >>> ZDCAnnotatableAdapter(obj) Flexible, because a different implemen

Re: [Zope3-dev] Re: adapter registration question

2006-11-15 Thread Jean-Marc Orliaguet
Philipp von Weitershausen wrote: Dieter Maurer wrote: Philipp von Weitershausen wrote at 2006-11-15 20:34 +0100: Dieter Maurer wrote: Philipp von Weitershausen wrote at 2006-11-15 15:08 +0100: ... def myStrAdapter(something): return str(something) It instantiates a 'str' object. The 'str'

Re: [Zope3-dev] Re: adapter registration question

2006-11-15 Thread Philipp von Weitershausen
Dieter Maurer wrote: Philipp von Weitershausen wrote at 2006-11-15 20:34 +0100: Dieter Maurer wrote: Philipp von Weitershausen wrote at 2006-11-15 15:08 +0100: ... def myStrAdapter(something): return str(something) It instantiates a 'str' object. The 'str' object is the adapter for 'somet

Re: [Zope3-dev] Re: adapter registration question

2006-11-15 Thread Jean-Marc Orliaguet
Philipp von Weitershausen wrote: Dieter Maurer wrote: Philipp von Weitershausen wrote at 2006-11-15 15:08 +0100: ... def myStrAdapter(something): return str(something) It instantiates a 'str' object. The 'str' object is the adapter for 'something'. Huh? This would be a severe terminology

Re: [Zope3-dev] Re: adapter registration question

2006-11-15 Thread Dieter Maurer
Philipp von Weitershausen wrote at 2006-11-15 20:34 +0100: >Dieter Maurer wrote: >> Philipp von Weitershausen wrote at 2006-11-15 15:08 +0100: >>> ... def myStrAdapter(something): return str(something) >>> It instantiates a 'str' object. The 'str' object is the adapter for >>> 'someth

Re: [Zope3-dev] Re: adapter registration question

2006-11-15 Thread Philipp von Weitershausen
Dieter Maurer wrote: Philipp von Weitershausen wrote at 2006-11-15 15:08 +0100: ... def myStrAdapter(something): return str(something) It instantiates a 'str' object. The 'str' object is the adapter for 'something'. Huh? This would be a severe terminology abuse: I agree, it's bending th

Re: [Zope3-dev] Re: adapter registration question

2006-11-15 Thread Dieter Maurer
Philipp von Weitershausen wrote at 2006-11-15 15:08 +0100: > ... >> def myStrAdapter(something): >>return str(something) >It instantiates a 'str' object. The 'str' object is the adapter for >'something'. Huh? This would be a severe terminology abuse: An adapter should adapt something to so

Re: [Zope3-dev] Re: adapter registration question

2006-11-15 Thread Philipp von Weitershausen
Chris Withers wrote: Philipp von Weitershausen wrote: ...hence the quotes. It's a "function" in that I want to use it as an adapter that doesn't need to be instantiated by a factory before being used. All adapters need to be instantiated. Why? def myStrAdapter(something): return str(s

Re: [Zope3-dev] Re: adapter registration question

2006-11-15 Thread Martin Aspeli
Chris Withers wrote: > > Philipp von Weitershausen wrote: > >>> ...hence the quotes. It's a "function" in that I want to use it as an >>> adapter that doesn't need to be instantiated by a factory before being >>> used. >> >> All adapters need to be instantiated. > > Why? > > def myStrAda

Re: [Zope3-dev] Re: adapter registration question

2006-11-15 Thread Chris Withers
Philipp von Weitershausen wrote: ...hence the quotes. It's a "function" in that I want to use it as an adapter that doesn't need to be instantiated by a factory before being used. All adapters need to be instantiated. Why? def myStrAdapter(something): return str(something) This functi

Re: [Zope3-dev] Re: adapter registration question

2006-11-14 Thread Philipp von Weitershausen
Chris Withers wrote: Philipp von Weitershausen wrote: Chris Withers wrote: Christian Theune wrote: The problem you have is to provide a specification for the 'str' interface. There are a couple of problems here... 1. str is both a "function" and a "class" Nope. It's a class since Python 2

Re: [Zope3-dev] Re: adapter registration question

2006-11-14 Thread Chris Withers
whit wrote: hello RuleDispatch... What's RuleDispatch? Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/opt

Re: [Zope3-dev] Re: adapter registration question

2006-11-14 Thread Chris Withers
Philipp von Weitershausen wrote: Chris Withers wrote: Christian Theune wrote: The problem you have is to provide a specification for the 'str' interface. There are a couple of problems here... 1. str is both a "function" and a "class" Nope. It's a class since Python 2.2. ...hence the quo

Re: [Zope3-dev] Re: adapter registration question

2006-11-13 Thread Chris Withers
Christian Theune wrote: The problem you have is to provide a specification for the 'str' interface. There are a couple of problems here... 1. str is both a "function" and a "class" 2. I was to register the "function" str as an adapter for, say, the "class" int to the "class" str, so there's

Re: [Zope3-dev] Re: adapter registration question

2006-11-10 Thread Christian Theune
Morning, Rocky Burt wrote: > On Fri, 2006-10-11 at 08:00 +, Chris Withers wrote: >> This is a toy example, but I need to do something similar and can't seem >> to get the registration right... >> >> How can I register the str builtin as an adapter from python int objects >> to python str obj