>
> On Feb 6, 7:02 pm, Iain Duncan <[email protected]> wrote:
> > You can always get more stuff out of the registry in your view's init
> > method, making it behave like an adapter for more items. The ZCA registry
> > can accomplish most of what you would normally use a dependency injection
> > framework for, and is there as request.registry.
> >
> > Check out the online ZCA book. I've even read it described as 'dependency
> > injection on steroids'. =)
>
> Thanks for your feedback.
>
> Yes, ZCA is very powerful. Although it is used extensively by Pyramid,
> it is very elegantly hidden and I thought it is not meant to be used
> by developers.
>
>
It can absolutely be used by developers, and IMHO, if your project is big,
you're crazy not too. It's there, it's nicely packaged up, and it's super
powerful. I recognize that there is a big learning barrier to using it and
that's why it's largely 'under the hood', the Pyramid developers wisely
want to make sure that you don't have to understand zca interfaces and
adapters to use Pyramid. *Personally*, I think this, and the effort to get
past the "Zope Stigma" means that it is not touched on enough in the docs,
but Chris M and I disagree on that and it's his call (I respect and
understand his point, I just also respectfully disagree). I believe that
advanced developers would like Pyramid more if they more exposed to the the
ZCA possibilities.  I first came to Pyramid when it was BFG and all
configuration was done through ZCML and the standard practices were more
Zope 3 ish so I just went off and dug into it and became a ZCA zealot. ;-)

That said, I recognize that it is a real challenge to present a
multi-paradigm framework in the best way, and I think Pyramid's real
differentiator is it's multi-paradigm nature. It can be a tiny procedural
super fast micro-framework or a giant component based extendable system.
I'm really not sure how to improve that situation, perhaps parallel sets of
docs. Unfortunately the Pyramid team has had to fight against some really
misguided anti-zope stigma with people complaining about "why use the zca?
why use interfaces?" just because they have never taken the time to
understand a component based architecture system and realized how it can be
an excellent way to build big software.


> A Pyramid view already works as an adapter. It adapts the context and
> the request. However, I did not figure out yet how to register views
> into Pyramid that expect more that the context and the request. Do I
> have to write a custom view_config decorator?
>

I suppose you could but I haven't done that, I just use lots of composition
(adapters inside views). There's nothing preventing you from getting
adapters inside a normal view, even adapting self. We do that a lot.  We
use interfaces extensively, all our base view classes provide them and all
our db model classes too. So whenever we need to get components, more
adapters are looked up, and the zca takes care of getting the right thing
for some class of view, db resource, and request.  It has worked
BEAUTIFULLY in terms of having a large set of libraries shared over all our
client applications with the ability to very easily and cleanly over-ride
components on a per-application basis. I found that I actually prefer doing
all configuration in ZCML for this, it's very nice to have the train
station defined in one kind of file. Our general rule is: Python code
should be easily used by either base libraries or client apps, and
configuration of what's going where and what's being overridden is always
done in certain zcml files using the include_overrides functionality.



> One more thing. Here
> http://www.mail-archive.com/[email protected]/msg01851.html
> I read that you are working on a resource oriented CMS. Did you
> publish the code already?
>

I'm afraid not, and I'm not sure when that will happen. We're a very small
company and, sadly, right now have to prioritize business stuff. I dearly
hope to get to the point in the next six months to year where focussing on
the business stuff frees up enough of my time to work on cleaning up and
publishing code, but at the moment, it's mostly me doing a school of hard
knocks MBA. :-/

Thanks
Iain

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to