[Zope-dev] Put an adapted object in context

Santi Camps santi at zetadb.com
Fri Feb 13 05:58:08 EST 2004


> Okay, though Acquisition.Implicit is actually going to make your namespace
> issues worse; better use Acquisition.Explicit and enjoy another benefit of
> adapters -- namespace separation. I suspect though that your application's 
> goals/design are different than mine. I appreciate adapters in part because
> they can support a much cleaner partioning of code, while you're interested
> in them primarily for the added dynamism, which is of course another major
> benefit of them.
> 

That's it.  

> > Sure.  Now my little adapters systems is beginning to work fine, and I
> > will move my application this way.  I'm using a simple engine, a method
> > to define which adapters should be applied to each meta_type (this info
> > is stored in SESSION) and then this adapters are transparently applied
> > when accessing this kind of objects (writing some code in
> > __bobo_traverse__).
> 
> Sounds a bit like views (which is a special kind of adapter in a way); what're
> the adapters doing? 
> 
> A registry that maps meta_type to views is what we've been using inside Silva for
> a long time, but we're going to move away from this towards mapping interface
> to views/adapters, like in Zope 3, hopefully soon.
> 
> One important idea is that an object can have multiple views simultaneously,
> instead of one big view standing in for all aspects of looking at the object. 
> Associating views with interfaces makes it possible to associate some views for
> the 'base interfaces' of an object (and thus for a large class of objects) while
> others only apply to very particular interfaces (and thus a much smaller class
> of objects).
> 

Yes, the most important difference is that CMF and Silva are content
management systems, and I'm focussing my efforts in to use Zope as a
bussiness applications development framework.

I use adapters to apply a Model View Controler pattern.  I've diveded my
development into:

1) Types. Basic objects with its model methods and its unitary views. 
For instance, a Folder with its creation and modification methods and
forms, but without any logic (neither navigation between methods,
REQUEST doesn't appear here).

2) Applications.  Each application acts as a controller of used Types,
and also can add some custom views.  This functionallity is added
throught adapters.  So, the application can decide in which framework
should appear the add_folder_view, where its submit should be sended,
and what should be done after adding.

This way, same object could be used from various applications with no
problems.  All the logic and navigation is decided in each application.

Regards

-- 
Santi Camps
http://zetadb.sourceforge.net




More information about the Zope-Dev mailing list