Hey folks, I have some stuff in middleware that I need my models in a
bfg traversal graph to be able to get at. But I'm not sure what the
correct way for those to get at the environ is. I could tack the environ
onto all objects starting at default_get_root but that seems kind of
clunky. I was alternately thinking that I would make a factory that
could be looked up via ZCML to get the item I want, but I'm not sure
whether it's possible to get at the current request from a zca utility
or adaptor. Is there someway to do something like

( abstract model is in middleware )

<utility for="IAbstractModel" factory="dram.get_abstract_model"/>

and have get_abstract_model in turn look up the wsgi environ by asking
to get the current request from the IRequest interface? Or some other
way to get at the request on the model side of traversal? Or is this
considered bad form?


Repoze-dev mailing list

Reply via email to