BoboPOS and nested dictionaries
Hi all. I'm having a slight problem with BoboPOS and nested dictionaries. BoboPOS 2.0.2. The problem is that changes to a nested dictionary attribute are not being saved. Here are two of my workarounds, discovered just this morning. # Dictionary deletions not saved. Workaround: Delete # the dictionary item, make a shallow copy to a new # dict, and reassign the object attribute to it. del self.treatment_orders[treatment] d = {} for k,v in self.treatment_orders.items(): d[k] = v self.treatment_orders = d Next, to assign a dictionary sub-element, I would usually perform the following kind of operation: self.treatment_orders[treatment]['FREQ'] = frequency However, the changes aren't saved unless I borrow Python's deepcopy feature, and reassign the attribute to the dict copy. from copy import deepcopy d = deepcopy(self.treatment_orders) d[treatment]['FREQ'] = frequency self.treatment_orders = d Before I spend more time on this issue, I'd be interested in learning if there are any known problems with nested dictionaries in BoboPOS. Environment: Python 1.5.2a2, linux2 Best regards, Jeff Bauer Rubicon, Inc.
On Sun, 14 Feb 1999, Jeff Bauer wrote:
Hi all.
I'm having a slight problem with BoboPOS and nested dictionaries. BoboPOS 2.0.2. The problem is that changes to a nested dictionary attribute are not being saved.
Here are two of my workarounds, discovered just this morning.
# Dictionary deletions not saved. Workaround: Delete # the dictionary item, make a shallow copy to a new # dict, and reassign the object attribute to it. What about self.__changed__(1) ?
Andreas -- Win95: n., A huge annoying boot virus that causes random spontaneous system crashes, usually just before saving a massive project. Easily cured by UNIX. See also MS-DOS, IBM-DOS, DR-DOS, Win 3.x, Win98.
Andreas Kostyrka wrote: jb>> I'm having a slight problem with BoboPOS and nested dictionaries. jb>> BoboPOS 2.0.2. The problem is that changes to a nested dictionary jb>> attribute are not being saved. ak> What about self.__changed__(1) ? It works. I had overlooked self.__changed(1). Thanks for the advice! Best regards, Jeff Bauer Rubicon, Inc.
participants (2)
-
Andreas Kostyrka -
Jeff Bauer