[Cubicweb] Fwd: issue with RQLVocabularyConstraint
arthur.lutz at logilab.fr
Thu Sep 19 10:18:45 CEST 2013
-------- Original Message --------
Subject: issue with RQLVocabularyConstraint
Date: Wed, 18 Sep 2013 22:05:44 +0200
From: Alexandre Fayolle <afayolle.ml at free.fr>
To: cubicweb at lists.cubicweb.org
It's been a while since I had to work with CW and I'm currently facing
an issue on an instance I have to update. I'm using cubicweb 3.16.6
I have extracted a simple cube illustrating my issue. It is available on
hg clone https://firstname.lastname@example.org/agurney/cwdemo demo
(I had an afterthought with naming it 'demo' on bitbucket, but the
modname in the code is "demo" so it is necessary to rename the clone
back to demo). The important parts are:
* views.py, with a couple of uicfg tweaks
Creating an instance from that cube will generate some demo data (which
can take a few minutes, I have not optimized the postcreate script).
Once the instance runs, browse to an entry, and select one of the groups
with a name starting with 'A'. Modify that entity, and add a ValueRelAB
relation. This takes a while because the RQLVocabularyConstraint in the
schema which should restrict the possible GroupB to the one linked to
the same Entry as the GroupA is not taken into account.
I'm pretty sure there is a workaround for this, but I could not find it.
I've traced the code down to cubicweb/entity.py cw_unrelated_rql which
does not process the constraint because
# this is True
if isinstance(cstr, cstrcls) and searchedvar.name in cstr.mainvars:
# this is True
if not self.has_eid():
# lt_infos is an empty dictionary
I guess I need to pass some smart lt_infos, but I'm a bit lost on how
this is done. Your help is very welcome.
Thanks in advance.
PS: The real db is the one of my wife's PhD thesis, and there are circa
10k GroupB equivalents in there, just displaying the names in a way
enabling telling them apart requires an additional RQL query for each,
and things are getting awfully slow. It was fine until now because the
DB was used read only, but she needs to input some additional data she's
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Cubicweb