missing the brackets on the commit. Should be transaction.commit(). Now it works as expected.
On Sunday, 20 November 2016 22:20:36 UTC, Jo G 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 "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/e9b65c6f-9c48-441a-a219-280decd7bc4e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
