cubicweb/test/data/rqlexpr_on_computedrel.py
author Denis Laxalde <denis.laxalde@logilab.fr>
Tue, 13 Sep 2016 10:16:00 +0200
changeset 11472 bc04039acd2e
parent 11057 0b59724cb3f2
permissions -rw-r--r--
[config] Make available_cubes aware of cubes installed as packages For this add a "cubicweb.cubes" entry points group which will be scanned through to find out installed cubes. Entries in this group are expected to expose the module name of a cube (i.e. `cubicweb_foo`). Note that CubicWebConfiguration's available_cubes method will return the module name of cubes as packages (cubicweb_foo), so we had to add a special "key" sorting function to keep cubes sorted as before, despite possible different distribution schemes. This makes it possible to handle loading of CTL plugins in an almost similar manner as before (just tweaking the package name from cube name in load_cwctl_plugins method). I had to tweak (again?) the test_cubes_path method in unittest_cwconfig.py but did not find out why. Apart from unforeseen bugs and pending documentation, this finishes the work on porting cubes to standard Python packages. Closes #13001466.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10554
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     1
from yams.buildobjs import ComputedRelation, EntityType, RelationDefinition
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     2
from cubicweb.schema import RRQLExpression
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     3
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     4
class Subject(EntityType):
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     5
    pass
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     6
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     7
class Object(EntityType):
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     8
    pass
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     9
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    10
class relation(RelationDefinition):
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    11
    subject = 'Subject'
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    12
    object = 'Object'
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    13
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    14
class computed(ComputedRelation):
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    15
    rule = 'S relation O'
c39749d14c53 [test] check that we reject an rqlexpression in computed relation perms
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    16
    __permissions__ = {'read': (RRQLExpression('S is ET'),)}