[Cubicweb] Entity._cw nature

Christophe de Vienne christophe at unlish.com
Mon Jul 7 23:36:58 CEST 2014


I am having trouble with self._cw inside an Entity method.

When called from a web request, it is a TwistedRequest (or something
close), an when called from a worker task, it is a InternalSession.

When I need to access the repo attribute, or get an internal_session (or
just deactivate security temporary) I have to check what I am dealing with.

The same issue will arise when using views from a task.

Since this is related to the web request/cnx distinction, I would like
to know if the ongoing work in 3.21 will do something about it ?

If it doesn't, how about saying that self._cw, in Entity and hooks at
least, but maybe also in views, should always be a cnx ?
How much code would it break ?



More information about the Cubicweb mailing list