[Cubicweb] Link or merge two instances?

Adrien Di Mascio adrien.dimascio at logilab.fr
Mon Dec 6 18:18:33 CET 2010


On 06/12/2010 17:55, Florent Cayré wrote:

> import pickle
> cards = pickle.load(file('/tmp/out.pickle'))
> for card in cards:
>    rql('INSERT Card C: C title %(title)s, C synopsis %(synopsis)s, C
> content %(content)s, C wikiid %(wikiid)s', card)

In that case, I would suggest to use create_entity for simplicty sake :

import pickle
for card in pickle.load(file('/tmp/out.pickle')):
    create_entity('Card', **card)

Just-nipticking-ly yours,
Adrien Di Mascio - LOGILAB, Paris (France).
Formations - http://www.logilab.fr/formations
Développements - http://www.logilab.fr/services
Gestion de connaissances - http://www.cubicweb.org/

More information about the Cubicweb mailing list