[Cubicweb] ORMHelper registry

Sylvain Thénault sylvain.thenault at logilab.fr
Wed Mar 9 10:49:59 CET 2011

On 09 mars 10:49, Adrien Di Mascio wrote:
> >I ask you the question : then what?
> Well, then ... how would I do be able to do that with the current API ?
> >IMO there are two different things:
> >
> >* moving api to control order and fetched attributes away from entity,
> >   and into an adapter to make this easily overridable per entity (and more,
> >   such as relation being traversed as you told earlier)
> +1. I'm not sure I would prefer an adapter over a new decicated
> registry. Is:
>   db_entity = entity.cw_adapt_to('OrmEntity')
>   rset = db_entity.related('my_relation')
>   # or: entities = db_entity.my_relation
> the kind of thing you're thinking of ?
> This would remove ``related()`` from entity's API. It would probably be
> a good thing per se but i fear it would be painful to write because
> ``related()`` is used __so often__ ...

No. I don't think want to move `related` yet. But its internals should
use an adapter holding order/prefetched attributes.

Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org

More information about the Cubicweb mailing list