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) does an adapter lookup based on the type of 'myobj'

That's the lookup in the registry (part 1 of the adapter call)

and returns an adapter instance with myobj as context, ready to be used.

That's the instantiation a la str(123) (part 2 of the adapter call)

Ah, I think this is becoming clearer...

So, as another example, I could register the following as a factory for turning instances of DateTime instances into datetime instances:

def convert_dates(date):
   return datetime(year=date.Year(),month=date.Month(),day=date.Month())

The important thing here, for me, is that the adapted value is not an instance of the adapter factory.

Am I getting this now?



Simplistix - Content Management, Zope & Python Consulting

Zope3-dev mailing list

Reply via email to