00:09.30 | anykey | ah never mind I need to build the python datetime.date type... |
00:27.14 | *** join/#storm drudi (n=drudi@189.121.88.120) |
02:45.14 | *** join/#storm soopos_ (n=soopos@130.233.228.12) |
03:40.42 | *** join/#storm gabriel (n=gabriel@d24-141-18-191.home.cgocable.net) |
03:42.44 | gabriel | are there any docs about the "validation framework" mentioned by jamesh at http://www.advogato.org/person/jamesh/diary/270.html ? |
03:43.57 | gabriel | my searches on both the storm wiki and google didn't turn up anything |
05:33.15 | jamesh | gabriel: sorry, missed your question earlier. |
05:34.07 | jamesh | a Storm validator is a function (or other callable object) that takes three arguments: the object, attribute name and value |
05:34.20 | jamesh | it should return the value that the property should be set to |
05:34.35 | jamesh | if the validator function raises an exception, then the property is not set |
05:45.59 | jamesh | oh. and you can set the validator for a property with the validator keyword argument to the constructor (e.g. Int(validator=foo)) |
05:54.19 | *** join/#storm stub (n=stub@ppp-58-8-4-170.revip2.asianet.co.th) |
06:11.43 | gabriel | jamesh: thanks for the reply. I probably should have addressed it directly to you |
06:12.28 | gabriel | jamesh: is the attribute name passed as a string? |
06:14.42 | jamesh | gabriel: yeah |
06:14.55 | gabriel | ok |
06:15.55 | gabriel | jamesh: is there any support for validators on references or reference sets? or should that be done as validators on the id properties of the link itself? |
06:16.24 | jamesh | gabriel: only on the properties. |
06:19.29 | gabriel | jamesh: but setting validators on a foreign id property could be used to achieve the same result as having a validator on the reference, right? |
06:20.44 | jamesh | gabriel: if you've got a reference like foo = Reference(foo_id, Foo.id), then executing "object.foo = bar" will end up doing "object.foo_id = bar.id", which will trigger foo_id's validator |
06:21.26 | gabriel | Great. That is tremendously helpful. Thanks a lot! |
06:21.39 | jamesh | if "bar" has not been flushed to the database yet (in which case it won't have a database ID yet), the validator won't run until the flush happens though. |
06:23.47 | gabriel | jamesh: hmmm...yes, I could see that causing some pretty subtle bugs if not kept in mind |
06:25.15 | jamesh | although if you're using transactions properly, it shouldn't be a big issue. |
06:26.38 | gabriel | i assume a flush occurs every time a transaction is committed? |
06:31.08 | gabriel | jamesh: are reference-based validators not included by design, or is it just that no one has designed/written support for them yet? |
06:33.53 | jamesh | gabriel: It is more a case that we didn't have a need for them |
06:36.13 | jamesh | also, I'm not sure why you'd want a validator attached to a reference that was not run when the underlying field was changed. |
06:40.22 | gabriel | jamesh: Yes, perhaps what I'm envisioning (a validator set through a reference but that also attaches itself to the appropriate property) is a bit too magic and not particularly useful. |
06:46.01 | jamesh | gabriel: I guess the problem with that is that a particular property might be involved in multiple references. |
06:46.22 | jamesh | e.g. a Reference(on_remote=True) or ReferenceSet() on the other class |
06:47.00 | jamesh | if you can specify the validators on references and reference sets, then what happens when you have conflicting validators? |
06:47.24 | jamesh | by having the validator on the property itself, it is unambiguous what will be run |
06:48.21 | gabriel | jamesh: that makes plenty of sense. So I guess the answer to my earlier question would be "by design" ;) |
06:49.29 | jamesh | well, the main constraints on the design were simplicity and the ability to handle most of Launchpad's use of the SQLObject validation API |
06:50.55 | jamesh | if you had something that couldn't be handled by the existing API, then that might have been a reason to extend it |
06:51.18 | jamesh | but it sounds like your use cases are fairly similar to the ones we've already run into |
06:51.37 | jamesh | so hopefully what's already there meets your needs |
06:52.18 | gabriel | jamesh: yes, sounds like it should |
08:28.44 | gabriel | jamesh: thanks again for your help - I've updated https://storm.canonical.com/Manual with some of what you told me. Hopefully I haven't misrepresented anything you said |
08:45.26 | gabriel | the info i added is in the property constructor parameters section |
09:27.38 | *** join/#storm mikex2 (n=mikael@193.11.22.216) |
09:43.03 | *** join/#storm zmijunkie (n=chatzill@83.135.53.218) |
10:13.46 | *** join/#storm jtv (n=jtv@ppp-124-120-193-8.revip2.asianet.co.th) |
10:14.19 | jtv | therve: looks like your fix for bug 475148 is all ready to land |
10:14.22 | mup | Bug #475148: Object leak on reference flush <Launchpad Translations:Triaged> <Storm:Confirmed for therve> <https://launchpad.net/bugs/475148> |
10:14.27 | jtv | is overjoyed :) |
11:04.11 | *** join/#storm stub (n=stub@58.8.4.170) |
12:01.57 | *** join/#storm fcorrea (n=fcorrea@187.3.137.148) |
12:05.52 | *** join/#storm drudi (n=drudi@189.116.190.244) |
12:08.51 | *** join/#storm hazmat (n=kapil@plone/hazmat) |
12:15.48 | *** part/#storm jtv (n=jtv@ppp-124-120-193-8.revip2.asianet.co.th) |
12:17.57 | *** join/#storm elmom (n=elmom@hoasnet-fe29dd00-137.dhcp.inet.fi) |
13:08.18 | *** join/#storm jukart (i=lovely@81.189.156.94) |
13:23.05 | *** join/#storm andrea-bs (n=andrea@ubuntu/member/beeseek.developer.andrea-bs) |
13:36.24 | *** join/#storm ursula (n=ursula@canonical/launchpad/ursinha) |
13:54.17 | *** join/#storm srichter (n=quassel@75.150.101.45) |
14:06.38 | *** join/#storm sidnei (n=sidnei@plone/dreamcatcher) |
15:24.47 | *** join/#storm artista_frustrad (n=artista_@201-15-253-240.ctame704.dsl.brasiltelecom.net.br) |
15:49.48 | *** part/#storm soopos (n=soopos@130.233.228.12) |
16:08.13 | *** join/#storm mikex2 (n=mikael@193.11.22.216) |
17:38.39 | *** join/#storm seiflotfy1 (n=seif@P5118.pallas.wh.tu-darmstadt.de) |
17:48.06 | *** join/#storm niemeyer (n=niemeyer@189-30-249-216.pltce701.dsl.brasiltelecom.net.br) |
18:14.47 | *** join/#storm keppla (n=keppla@i5E868F6A.versanet.de) |
18:59.07 | *** join/#storm jkakar (n=jkakar@24.84.196.20) |
19:26.55 | *** join/#storm jkakar (n=jkakar@S0106001ee57a879c.vc.shawcable.net) |
23:53.42 | *** join/#storm drudi (n=drudi@189.64.75.185) |