[Cubicweb] Error while defining a relation

Sylvain Thénault sylvain.thenault at logilab.fr
Thu Jul 7 14:46:04 CEST 2011


On 07 juillet 12:29, GEFFROY Dominique INSERM wrote:
> Dear Cubicweb experts,
> 
> I'm trying to define a new schema for a cube but I get an error about a RelationDefinition that I don't understand.
> 
> Here is my RelationDefinition:
> 
> class has_file(RelationDefinition):
>     subject = "*"
>     object = 'String'
>     cardinality='**'
>     composite="subject"
> 
> And here is the error while creating a database for an instance of the cube:
> 
> Initializing the system database
> --------------------------------
[snip]
>   File "/usr/lib/python2.6/dist-packages/cubicweb/web/uicfg.py", line 438, in init_actionbox_appearsin_addmenu
>     if not rdef.role_cardinality(role) in '?1' and rdef.composite == role:
> AttributeError: 'RelationDefinitionSchema' object has no attribute 'composite'
> 
> I don't understand why it complains about this composite attribute, I defined it in my class. Did I do something wrong ?

The error doesn't help... The pb is that you add an attribute (since object='String')
relation to every possible entity types (do you really want this ?), while the
'composite' relation property is only available for non-attribute relation.

Try:

  class has_file(RelationDefinition):
     subject = "*"
     object = 'String'


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




More information about the Cubicweb mailing list