[Cubicweb] Foaf implementation

Stéphane Bugat stephane.bugat at free.fr
Tue Jul 24 17:36:22 CEST 2012

Sylvain (and all CW lovers),

I recently updated and pushed some modifications on bitbucket/foaf. I wrote a unittest script following your recommandations. I also tried to use your 'allow_all_hooks_but' trick to avoid any infinite loop.


My code is getting more and more complicated and I still can't avoid this loop. The unittest fails and I've spent already several, not to say many, hours to get why.

I came to the point where a new view would be welcomed, because I'm unable to see anything at this point. So any help would be appreciated!

Best regards


----- Mail original -----
> De: "Sylvain Thénault" <sylvain.thenault at logilab.fr>
> À: "Stéphane Bugat" <stephane.bugat at free.fr>
> Cc: cubicweb at lists.cubicweb.org
> Envoyé: Mercredi 18 Juillet 2012 16:25:44
> Objet: Re: [Cubicweb] Foaf implementation
> On 18 juillet 16:11, Stéphane Bugat wrote:
> > Yes Sylvain, I should rather write a unittest but actually I use
> > those small scripts to create a small database and perform some
> > tests with it using the web interface afterwards... But I do admit
> > that this kind of trial/error operation is not correct.
> > 
> > No, there is no infinite loop. I forgot to mention that I also
> > tried it with an empty __call__() method for the sync hook (do
> > nothing and just returns), and the problem remains the same...
> A unittest would allow us to easily reproduce your pb. Quickly
> looking at
> your code, I see at least one potential infinite loop in
> syncUserPersonHook:
> you edit a user, hook edits related person, hook edits related user,
> etc.
> Tip (probably undocumented): add 'category = "synchronization" to
> your hook.
> then, call set_attributes withing a
>   with self._cw.allow_all_hooks_but("synchronization"):
>       x.set_attributes(...)
> block. This would probably also apply to email sync hook.
> --
> Sylvain Thénault, LOGILAB, Paris ( - Toulouse
> (
> 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