[Cubicweb] Understanding _cw

Sylvain Thénault sylvain.thenault at logilab.fr
Fri May 16 14:15:35 CEST 2014

On 16 mai 13:57, Christophe de Vienne wrote:
> Le 16/05/2014 10:22, Sylvain Thénault a écrit :
> > On 16 mai 10:05, Christophe de Vienne wrote:
> >> The most simple solution is to separate in 2 or 3 attributes/params.
> >> - cw for config, reg and repo, because it is all the instance-wide objects
> >> - cnx when a connection but no request is needed.
> >> - request when a request is needed.
> > sounds good, though I would rephrase the two last points: 
> > - cnx when a connection to the repo is established
> > - request when the originator is an HTTP request
> >
> > Take care that in some case, we'll have to process an HTTP request without a
> > connection being established (eg register/lost password form for site where
> > anonymous are not allowed).
> A request exists before it is linked to a cnx, and even any repo or
> config (at the very early stage of handling it).

> The case of the views remains unclear to me. A cnx feels not enough (am
> I wrong on that ?), and a request way too much : we should be able to
> use views outside the handling of http requests.

Yes again.

Did I say something that contradict those two points? 

> >> The request object could have a 'cnx' attribute.
> >> We could even have a 'cw' attribute on cnx, removing the need for a cw
> >> argument when calling appobjects.
> > This is not clear to me. Currently the cw is an argument mostly because of it
> > being the request object.
> Well, removing the cw argument and have it as an attribute on request
> would make the api more pyramid-like.

ok, fine. I fully agree that everything that allows cubicweb to look similar to
other popular framework such as pyramid is a good step forward by easing its
adoption. Ultimatly, having cubicweb specificities on top of a generic web
framework as pyramid would be awesome (IMO).

Sylvain Thénault, LOGILAB, Paris ( - Toulouse (
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