Re: Update properties of zodb objects from a celery task via pyramid_celery not working

Jo Gilder <[email protected]>
Newsgroups gmane.comp.web.zope.zodb
Message-ID <[email protected]>
missing the brackets on the commit. Should be transaction.commit(). Now it 
works as expected.

On Sunday, 20 November 2016 22:21:34 UTC, Jo Gilder wrote:
>
> So in my content system (based on substanced) I set the name of the zodb 
> content item programatically based on the values of other properties of 
> that object. Some of the child elements of this content item are named 
> based on their parent. I need to programitically update the names of the 
> children too. 
> If I do this from within the set function of the Property of the parent 
> object then it works but it is slow. Instead I am trying to run it 
> afterwards using celery. I use very similar code but it doesn't update the 
> child object name. Any ideas?
>
> The code I am using to update the zodb object is
>
>                  new_name = 
> agent_artifact_ref_name_calc_value(content_ob.__parent__, struct_ref)
>                  struct_artifact_ref = get_properties(content_ob, registry)
>                  struct_artifact_ref[u'name'] = new_name
>                  setattr(content_ob, 'name', new_name)
>                  transaction.commit
>    
> Indexing the zodb is slow so it is deferred and the deferred process is 
> run by supervisor which is run every 5 seconds.
>
> The celery task to update the children is run from an event which is 
> triggered after the parent object is updated.  I have delayed this task so 
> that it is run after the parent object is re-indexed.  I can pick the 
> correct child objects by querying the catalog. I then update the names of 
> the objects. In substanced changing the name of an object is equivalent to 
> a remove and then an add. Changing the name of the child object triggers 
> all the reindex methods for the catalog but doesn't seem to pick up the 
> change in the name.
>
> Any ideas?
>
>

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.