[Cubicweb] Correct use of the 'person' cube

Stéphane Bugat stephane.bugat at free.fr
Fri Jul 13 08:23:52 CEST 2012

Fine for me, Nicolas. 

One last question: I'd like to sync 'surname', 'firstname' attributes and email relations of both Person and CWUser in one and unique hook. For that I propose to select with a Hook.__select__ & (is_instance('Person') | is_instance('CWUser')) and to select on events ('after_add_entity', 'after_update_entity').
Is there a way to retrieve the selected event and instance in the __call__() method of the hook?


----- Mail original -----
De: "Nicolas Chauvat" <nicolas.chauvat at logilab.fr>
À: "Stéphane Bugat" <stephane.bugat at free.fr>
Cc: cubicweb at lists.cubicweb.org
Envoyé: Jeudi 12 Juillet 2012 22:43:21
Objet: Re: [Cubicweb] Correct use of the 'person' cube

On Thu, Jul 12, 2012 at 09:24:05AM +0200, Stéphane Bugat wrote:

> I've started to reshape my datamodel but discovered that there was
> already a 'UserAccount' entity defined in cubicweb-blog (although it
> was not directly visible on the SVG website scheme...).

I wrote this. :)

> I really have difficulties to understand how all this works. It
> seems that UserAccount is somehow linked to CWUser but the
> 'sobjects.py' file in cw-blog is hard to embrace.

At some point, I add a "internet newspaper" application on my laptop
that I would use to gather all the articles of my news feeds and all
the tweets of my contacts in one place.

Since a news article can be modeled as a blogentry and a tweet as a
microblogentry, I wrote the first version of the datafeed extension
that downloads everything, parses everything and creates
(micro)blogentry entities.

In sobjects, you'll find the code related to downloading and parsing
the feeds and tweets and storing the data locally.

I took the opportunity to try to fix the CWUser-as-a-person mistake
and have a distinct UserAccount entity. This entity exist only in the
blog cube. My goal was to show in the blog cube that it could work and
use it to convince the other developers of CW that we should plan the
switch at the global level.

Short answer is CWUser != UserAccount, you may just ignore UserAccount
for what your are doing at the moment (unless I misunderstood what you
are trying to achieve, which is not an option to rule out too
quickly... just show me your code :).

Nicolas Chauvat

logilab.fr - services en informatique scientifique et gestion de connaissances  

More information about the Cubicweb mailing list