*** danielblackburn has quit IRC | 01:33 | |
*** danielblackburn has joined #zope | 03:18 | |
*** daMaestro has joined #zope | 04:12 | |
*** danielblackburn has quit IRC | 05:12 | |
*** alecm has quit IRC | 05:15 | |
*** alecm has joined #zope | 05:38 | |
*** alecm has joined #zope | 05:38 | |
*** lregebro has joined #zope | 07:07 | |
*** regebro has quit IRC | 07:11 | |
*** daMaestro has quit IRC | 07:41 | |
*** __mac__ has joined #zope | 08:10 | |
*** alecm has quit IRC | 08:30 | |
*** alecm has joined #zope | 08:31 | |
*** alecm has joined #zope | 08:31 | |
*** alecm has joined #zope | 08:32 | |
*** alecm has joined #zope | 08:32 | |
*** alecm has joined #zope | 08:32 | |
*** alecm has joined #zope | 08:32 | |
*** alecm has joined #zope | 08:33 | |
*** alecm has joined #zope | 08:34 | |
*** alecm has joined #zope | 08:34 | |
*** alecm has joined #zope | 08:35 | |
*** alecm has joined #zope | 08:35 | |
*** alecm has joined #zope | 08:36 | |
*** sylvain has joined #zope | 09:16 | |
*** El_Rolando has joined #zope | 10:00 | |
*** alecm has joined #zope | 10:14 | |
*** alecm has joined #zope | 10:14 | |
*** alecm has quit IRC | 10:29 | |
*** alecm has joined #zope | 10:29 | |
*** alecm has joined #zope | 10:29 | |
*** alecm has quit IRC | 10:30 | |
*** alecm has joined #zope | 10:30 | |
*** alecm has joined #zope | 10:30 | |
*** alecm has joined #zope | 10:31 | |
*** alecm has joined #zope | 10:31 | |
*** alecm has joined #zope | 10:32 | |
*** alecm has joined #zope | 10:32 | |
*** alecm has joined #zope | 10:32 | |
*** alecm has joined #zope | 10:32 | |
*** alecm has quit IRC | 10:33 | |
*** alecm has joined #zope | 10:33 | |
*** alecm has joined #zope | 10:33 | |
*** alecm has joined #zope | 10:34 | |
*** alecm has joined #zope | 10:34 | |
*** alecm has joined #zope | 10:35 | |
*** alecm has joined #zope | 10:35 | |
*** alecm has joined #zope | 10:36 | |
*** alecm has joined #zope | 10:36 | |
*** alecm has joined #zope | 10:36 | |
*** alecm has joined #zope | 10:36 | |
*** alecm has quit IRC | 10:37 | |
*** alecm has joined #zope | 10:37 | |
*** alecm has joined #zope | 10:37 | |
*** alecm has joined #zope | 10:38 | |
*** alecm has joined #zope | 10:38 | |
*** __mac__ has quit IRC | 11:33 | |
*** MrTango has joined #zope | 11:41 | |
*** noodlepie has joined #zope | 13:40 | |
*** noodlepie has quit IRC | 14:14 | |
*** __mac__ has joined #zope | 14:40 | |
*** MrTango has quit IRC | 15:47 | |
*** MrTango has joined #zope | 16:02 | |
*** danielblackburn has joined #zope | 16:19 | |
*** MrTango has quit IRC | 17:04 | |
*** MrTango has joined #zope | 17:06 | |
*** MrTango has quit IRC | 17:15 | |
*** MrTango has joined #zope | 17:20 | |
*** MrTango has quit IRC | 17:25 | |
*** projekt01 has joined #zope | 17:27 | |
*** valleedelisle has joined #zope | 17:28 | |
valleedelisle | ping zope I'm new to ZODB and for some reason, when I save an objects created with Persistence.Persistent, only the key name is saved in the ZODB, not the objects attributes | 17:36 |
---|---|---|
mgedmin | valleedelisle: pastebin your code please | 17:36 |
*** MrTango has joined #zope | 17:41 | |
valleedelisle | mgedmin, https://pastebin.com/az7Ky7ww | 17:43 |
valleedelisle | so cases=case_db.root["cases"] returns a dict with keys defined, but the objects are all empty | 17:43 |
valleedelisle | that's the problem | 17:43 |
mgedmin | valleedelisle: careful about accessing self.__dict__ directly in Persistent objects | 17:44 |
mgedmin | this sidesteps the Persistent machinery that notices changes | 17:44 |
mgedmin | and thus changes get lost | 17:44 |
valleedelisle | oh | 17:44 |
valleedelisle | that makes sense | 17:44 |
mgedmin | be sure to set self._p_changed = True afterwards | 17:44 |
mgedmin | do read the documentation, this is explained somewhere, I'm sure | 17:44 |
valleedelisle | ack, will do | 17:45 |
mgedmin | there are more gotchas you should know about! | 17:45 |
mgedmin | also, starting a python 2 project in 2018 is risky | 17:45 |
mgedmin | python 2 end-of-life is scheduled for jan 1 2020 | 17:45 |
mgedmin | migrating ZODB databases from python 2 to python 3 is a non-trivial problem that requires very custom code, tailored to a specific application | 17:46 |
valleedelisle | mgedmin, yeah I think I had problems with instance the persistence module in python3 | 17:46 |
mgedmin | you may safe yourself future trouble if you start on python 3 | 17:46 |
valleedelisle | this is not going to be a huge project, it's just a little tool we need | 17:46 |
valleedelisle | * said everyone that worked on a huge project | 17:47 |
valleedelisle | mgedmin, even with _p_changed = True, the attributes are not saved | 17:48 |
valleedelisle | mgedmin, how do you recommend dynamic attributes with Persistent ? Loop through kwargs and setattr ? | 17:49 |
mgedmin | kwargs + setattr seems fine | 17:50 |
valleedelisle | mgedmin, yeah even with this it doesnt work | 17:51 |
mgedmin | ok, the other issue | 17:51 |
mgedmin | case_db.root["cases"] = {} | 17:51 |
mgedmin | you see that {}? that's a dict | 17:51 |
valleedelisle | yup | 17:51 |
mgedmin | the persistence machinery cannot see dict modifications (or list modifications, etc) | 17:51 |
valleedelisle | oh yeah I read that somewhere | 17:51 |
mgedmin | so whenever you change it, you have to do case_db.root["cases"] = case_db.root["cases"] or something similar | 17:51 |
mgedmin | or you could use persistent.dict.PersistentDict() instead of {} and it would JustWork | 17:52 |
mgedmin | (or you could/should use a BTree, if this dict is expected to grow large -- say more than 100 items) | 17:52 |
betabug | BTree is what we use for those cases | 17:52 |
mgedmin | this sort of detail is why I recommended reading the documentation | 17:52 |
betabug | no matter if it's expected to grow or not | 17:52 |
betabug | just use BTree and the one time where it will grow and you didn't expect it, you're still covered | 17:53 |
mgedmin | hm, I see you already repeat the root["cases"] = cases before your transaction.commit() | 17:53 |
mgedmin | so I don't understand what's not getting persisted | 17:54 |
*** sylvain has quit IRC | 17:54 | |
*** sylvain has joined #zope | 17:55 | |
valleedelisle | mgedmin, I tried to self.connection.setDebugInfo(True) | 17:58 |
valleedelisle | mgedmin, but I don't get more information | 17:58 |
*** sylvain has quit IRC | 17:59 | |
mgedmin | no idea what that is | 17:59 |
valleedelisle | mgedmin, I found that in the doc, actually, that's the only thing about debug in the ZODB doc | 17:59 |
*** __mac__ has quit IRC | 18:19 | |
*** projekt01 has quit IRC | 18:21 | |
*** El_Rolando has quit IRC | 18:43 | |
*** alecm has joined #zope | 18:55 | |
*** alecm has joined #zope | 18:55 | |
*** MrTango has quit IRC | 19:04 | |
*** __mac__ has joined #zope | 19:09 | |
*** __mac__ has quit IRC | 19:22 | |
*** noodlepie has joined #zope | 22:05 | |
*** __mac__ has joined #zope | 22:17 | |
*** harrow` has quit IRC | 22:52 | |
*** harrow has joined #zope | 22:57 | |
*** noodlepie has quit IRC | 23:04 | |
*** noodlepie has joined #zope | 23:05 | |
*** __mac__ has quit IRC | 23:07 | |
*** __mac__ has joined #zope | 23:07 | |
*** __mac__ has joined #zope | 23:08 | |
*** noodlepie has quit IRC | 23:30 | |
*** MrTango has joined #zope | 23:54 |
Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!