This was because I was reloading the page and it was re-inserting the element. I sat here editing code, reloading, and on and on for like 4 hours. I'm gonna go bang my head on the wall for a while. ^Roman
"RM" == Roman Milner <roman@speeder.com> writes:
RM> Hello. I have a problem trying to use the Persistent mixin RM> class. I have a dictionary attribute that holds configurable RM> fields. The fields are added like this: RM> def store_new_fields(self, REQUEST): f = self.fields if RM> hasattr(REQUEST, 'abstract_p'): RM> f[string.strip(REQUEST.new_item_name)] = {'type': RM> REQUEST.dtype, 'abstract_p': REQUEST.abstract_p} else: RM> f[string.strip(REQUEST.new_item_name)] = {'type': RM> REQUEST.dtype, 'abstract_p': 0} self.fields = f RM> I then delete items thusly: RM> def del_fields(self, the_fields): f = self.fields if RM> type(the_fields) == type(""): del(f[the_fields]) else: for RM> fname in the_fields: del(f[fname]) self.fields = f RM> This mostly works fine except the most recently added new RM> field can not be deleted. The del() call does not raise an RM> error but when I look at self.fields.keys() after calling RM> del_fields() on the most recently added field - it still RM> exists. RM> I'm sure there is something with the persistence stuff that I RM> am missing. Any help would be greatly appreciated. RM> Thanks, ^Roman