[Cubicweb] Fwd: issue with RQLVocabularyConstraint

Arthur Lutz 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



Hello CWebers,

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
bitbucket:

hg clone https://agurney@bitbucket.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:

* schema.py
(https://bitbucket.org/agurney/cwdemo/src/e0d45522fcf0eeb366face83f7e0c5941b194b81/schema.py?at=default)
* views.py, with a couple of uicfg tweaks
(https://bitbucket.org/agurney/cwdemo/src/e0d45522fcf0eeb366face83f7e0c5941b194b81/views.py?at=default)

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
       if lt_infos:

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.

-- Alexandre

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
stumbled on...




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20130919/32c47a3c/attachment-0049.html>


More information about the Cubicweb mailing list