IRC log of #zope for Thursday, 2018-04-19

*** danielblackburn has quit IRC01:33
*** danielblackburn has joined #zope03:18
*** daMaestro has joined #zope04:12
*** danielblackburn has quit IRC05:12
*** alecm has quit IRC05:15
*** alecm has joined #zope05:38
*** alecm has joined #zope05:38
*** lregebro has joined #zope07:07
*** regebro has quit IRC07:11
*** daMaestro has quit IRC07:41
*** __mac__ has joined #zope08:10
*** alecm has quit IRC08:30
*** alecm has joined #zope08:31
*** alecm has joined #zope08:31
*** alecm has joined #zope08:32
*** alecm has joined #zope08:32
*** alecm has joined #zope08:32
*** alecm has joined #zope08:32
*** alecm has joined #zope08:33
*** alecm has joined #zope08:34
*** alecm has joined #zope08:34
*** alecm has joined #zope08:35
*** alecm has joined #zope08:35
*** alecm has joined #zope08:36
*** sylvain has joined #zope09:16
*** El_Rolando has joined #zope10:00
*** alecm has joined #zope10:14
*** alecm has joined #zope10:14
*** alecm has quit IRC10:29
*** alecm has joined #zope10:29
*** alecm has joined #zope10:29
*** alecm has quit IRC10:30
*** alecm has joined #zope10:30
*** alecm has joined #zope10:30
*** alecm has joined #zope10:31
*** alecm has joined #zope10:31
*** alecm has joined #zope10:32
*** alecm has joined #zope10:32
*** alecm has joined #zope10:32
*** alecm has joined #zope10:32
*** alecm has quit IRC10:33
*** alecm has joined #zope10:33
*** alecm has joined #zope10:33
*** alecm has joined #zope10:34
*** alecm has joined #zope10:34
*** alecm has joined #zope10:35
*** alecm has joined #zope10:35
*** alecm has joined #zope10:36
*** alecm has joined #zope10:36
*** alecm has joined #zope10:36
*** alecm has joined #zope10:36
*** alecm has quit IRC10:37
*** alecm has joined #zope10:37
*** alecm has joined #zope10:37
*** alecm has joined #zope10:38
*** alecm has joined #zope10:38
*** __mac__ has quit IRC11:33
*** MrTango has joined #zope11:41
*** noodlepie has joined #zope13:40
*** noodlepie has quit IRC14:14
*** __mac__ has joined #zope14:40
*** MrTango has quit IRC15:47
*** MrTango has joined #zope16:02
*** danielblackburn has joined #zope16:19
*** MrTango has quit IRC17:04
*** MrTango has joined #zope17:06
*** MrTango has quit IRC17:15
*** MrTango has joined #zope17:20
*** MrTango has quit IRC17:25
*** projekt01 has joined #zope17:27
*** valleedelisle has joined #zope17:28
valleedelisleping 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 attributes17:36
mgedminvalleedelisle: pastebin your code please17:36
*** MrTango has joined #zope17:41
valleedelislemgedmin, https://pastebin.com/az7Ky7ww17:43
valleedelisleso cases=case_db.root["cases"] returns a dict with keys defined, but the objects are all empty17:43
valleedelislethat's the problem17:43
mgedminvalleedelisle: careful about accessing self.__dict__ directly in Persistent objects17:44
mgedminthis sidesteps the Persistent machinery that notices changes17:44
mgedminand thus changes get lost17:44
valleedelisleoh17:44
valleedelislethat makes sense17:44
mgedminbe sure to set self._p_changed = True afterwards17:44
mgedmindo read the documentation, this is explained somewhere, I'm sure17:44
valleedelisleack, will do17:45
mgedminthere are more gotchas you should know about!17:45
mgedminalso, starting a python 2 project in 2018 is risky17:45
mgedminpython 2 end-of-life is scheduled for jan 1 202017:45
mgedminmigrating ZODB databases from python 2 to python 3 is a non-trivial problem that requires very custom code, tailored to a specific application17:46
valleedelislemgedmin, yeah I think I had problems with instance the persistence module in python317:46
mgedminyou may safe yourself future trouble if you start on python 317:46
valleedelislethis is not going to be a huge project, it's just a little tool we need17:46
valleedelisle* said everyone that worked on a huge project17:47
valleedelislemgedmin, even with _p_changed = True, the attributes are not saved17:48
valleedelislemgedmin, how do you recommend dynamic attributes with Persistent ? Loop through kwargs and setattr ?17:49
mgedminkwargs + setattr seems fine17:50
valleedelislemgedmin, yeah even with this it doesnt work17:51
mgedminok, the other issue17:51
mgedmincase_db.root["cases"] = {}17:51
mgedminyou see that {}?  that's a dict17:51
valleedelisleyup17:51
mgedminthe persistence machinery cannot see dict modifications (or list modifications, etc)17:51
valleedelisleoh yeah I read that somewhere17:51
mgedminso whenever you change it, you have to do case_db.root["cases"] = case_db.root["cases"] or something similar17:51
mgedminor you could use persistent.dict.PersistentDict() instead of {} and it would JustWork17:52
mgedmin(or you could/should use a BTree, if this dict is expected to grow large -- say more than 100 items)17:52
betabugBTree is what we use for those cases17:52
mgedminthis sort of detail is why I recommended reading the documentation17:52
betabugno matter if it's expected to grow or not17:52
betabugjust use BTree and the one time where it will grow and you didn't expect it, you're still covered17:53
mgedminhm, I see you already repeat the root["cases"] = cases before your transaction.commit()17:53
mgedminso I don't understand what's not getting persisted17:54
*** sylvain has quit IRC17:54
*** sylvain has joined #zope17:55
valleedelislemgedmin, I tried to         self.connection.setDebugInfo(True)17:58
valleedelislemgedmin, but I don't get more information17:58
*** sylvain has quit IRC17:59
mgedminno idea what that is17:59
valleedelislemgedmin, I found that in the doc, actually, that's the only thing about debug in the ZODB doc17:59
*** __mac__ has quit IRC18:19
*** projekt01 has quit IRC18:21
*** El_Rolando has quit IRC18:43
*** alecm has joined #zope18:55
*** alecm has joined #zope18:55
*** MrTango has quit IRC19:04
*** __mac__ has joined #zope19:09
*** __mac__ has quit IRC19:22
*** noodlepie has joined #zope22:05
*** __mac__ has joined #zope22:17
*** harrow` has quit IRC22:52
*** harrow has joined #zope22:57
*** noodlepie has quit IRC23:04
*** noodlepie has joined #zope23:05
*** __mac__ has quit IRC23:07
*** __mac__ has joined #zope23:07
*** __mac__ has joined #zope23:08
*** noodlepie has quit IRC23:30
*** MrTango has joined #zope23:54

Generated by irclog2html.py 2.15.1 by Marius Gedminas - find it at mg.pov.lt!