[Cubicweb] ERQLExpression for update and delete permissions

Carlos Balderas carlos.balderas at gmail.com
Wed Sep 29 06:21:25 CEST 2010

Syt, I am sending you the cube with some test you can run, but I think I
found where most of the time is consuming.

It seems to be at the moment of calling "publish" method in class
ViewController (cubicweb/web/views/basecontrollers.py)

to be more precise at the moment to execute line 122

return self._cw.vreg['views'].main_template(self._cw, template,
                                                rset=rset, view=view)

I went tracking until I got to this point, and more than 8 seconds are spent
here. (for my tests)

I am sorry for not going beyond this point, I got a little lost here since I
just starting to understand a little this part of cubicweb.

I think the ERQLExpression might be causing several validations here in some
way that make time consuming, not that I can be sure, but if I use a normal
users group like 'users', 'managers', etc to asign: read, update, add,
delete permissions, cw displays all results very fast.

I wrote these tests earlier, they just confirm rql queries work fine! :-)

1.- CubicWebTC based test (test/test_ERQL_time.py) showed no problem at all
with execution time for an rql sentence like 'Any X WHERE X is EntityOne'.

The result of this tests are pretty much the same using or not the
ERQLExpression to define dynamic permissions for this entity.

admin --> start time: 26.24 / end time: 26.26 / total: 0.02 secs
userx --> start time: 26.28 / end time: 26.3 / total: 0.02 secs

 --- Because this last test looked fine, I made a test inside a running
cubicweb instance, I didn't find the way to test the list view in.

2.- At this time I didn't find the way to make this other test in CubicWebTC
based form, so I just made it in a running cubicweb instance of my cube.

2.1.- Create a view TestEntityOne, and check again the execution time of the
rql query ('Any X WHERE X is EntityOne')
admin --> start time: 3.33 / end time: 3.35 / total: 0.02 secs
userx --> start time: 3.12 / end time: 3.14 / total: 0.02 secs

The results were equal, they shouldn't be different, but I wanted to test it
anyway since the tests run in different database (sqlite, postgresql).

3.- Last test was about displaying a result set of EntityOne. I sent the
rset of the same rql query ('Any X WHERE X is EntityOne') to be displayed in
"list" view and an other new list view I wrote called "newlisttest", I found
out that most of the time is spent in this process.
(The conclusion of the test is explained at the begin of this email)

Thank you,
I hope this helps to see if cw has an opportunity case to be improved in
this part of the code.

Best Regards
Carlos Balderas

On Tue, Sep 28, 2010 at 9:42 AM, Carlos Balderas
<carlos.balderas at gmail.com>wrote:

> On Tue, Sep 28, 2010 at 9:39 AM, Carlos Balderas <
> carlos.balderas at gmail.com> wrote:
>> On Tue, Sep 28, 2010 at 9:27 AM, Sylvain Thénault <
>> sylvain.thenault at logilab.fr> wrote:
>>> On 28 septembre 07:48, Carlos Balderas wrote:
>>> > Hi Syt !, sure...
>>> >
>>> > * The cube uses a user named "userx" with the same password.
>>> >
>>> > * Everything you need is created in precreate and postcreate files.
>>> > - Oh, question about this, Why precreate.py is not created
>>> automatically
>>> > when you create the cube, Is this file going to be replaced in other
>>> place
>>> > of the cube creation?. Of course I won't mind creating it when I need
>>> it,
>>> > but I was wondering if this kind of input process will be migrated in
>>> some
>>> > other part of the cubicweb code.
>>> precreate is simply not created by default since you usually don't need
>>> it. See --layout option for the newcube command to get more things.
>> OK
>>> > * Just create your cw instance and login with u:userx, p:userx , and
>>> you can
>>> > just query EntityOne, after that, you can uncomment the lines of
>>> > ERQLExpression in schema, recreate the database and see what happends
>>> with
>>> > the execution time.
>>> You mean execution time of the list view giving all EntityOne instance in
>>> your database?
>> Yes, meaning:
>> http://localhost:8080/EntityOne or by rql on rql input box "Any X WHERE X
>> is EntityOne"
>>> > Please let me know if you need more specific tests, so I can write them
>>> and
>>> > send them to you.
>>> being able to test this with simply a test file (CubicWebTC based) would
>>> be great. If you can do this quick, that's  great, else nevermind and
>>> I'll
>>> look at it asap with a living instance.
>> I
> I will make the test (CubicWebTC based) and send it to you, =)
> Thank you.
> Carlos Balderas
>>> --
>>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20100928/883059d4/attachment-0187.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcase.tar.gz
Type: application/x-gzip
Size: 7246 bytes
Desc: not available
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20100928/883059d4/attachment-0274.bin>

More information about the Cubicweb mailing list