Merge lp:~mhall119/apps-brancher/fix-1010507 into lp:~dholbach/apps-brancher/trunk
Status: | Merged |
---|---|
Merged at revision: | 43 |
Proposed branch: | lp:~mhall119/apps-brancher/fix-1010507 |
Merge into: | lp:~dholbach/apps-brancher/trunk |
Diff against target: |
12 lines (+1/-1) 1 file modified
brancher/appcache.py (+1/-1) |
To merge this branch: | bzr merge lp:~mhall119/apps-brancher/fix-1010507 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel Holbach | Pending | ||
Review via email: mp+109441@code.launchpad.net |
Commit message
Use a copy of the app data, not the app data itself, before converting the timestamp to a serializable form
Description of the change
Well this was a fun one to track down, and has everything to do with how Python objects work.
When you use:
data = app.__dict__
You aren't getting new dictionary with a copy of app's fields and data, it's actually the app itself in dictionary form.
So when you do:
data['
You're actually changing app.tarball_
Now, app was placed into the self.cache list. Not a copy of app, but a reference to the actual app instance. So, when you changed the dictionary form of the app instance, you also changed it in the cache.
So essentially, when saving the cache to a file, you were changing the in-memory cache so that the app instance it held had it's tarball_timestamp field converted from a datetime to an str.
Fun huh?
WOW. Let me try this out.