/srv/irclogs.ubuntu.com/2015/09/09/#launchpad-dev.txt

cjwatsonwgrant: Is there a good way to handle the case where setting one field in a Storm class needs to potentially adjust that value depending on the value of another field?  Setting git_path needs to do git_repository.getRefByPath(); but if I just do the naïve thing and write git_path.setter, I get an IntegrityError while submitting edit forms, because updateContextFromData sets git_repository and then attempts to set git_path, but the ...00:05
cjwatson... implicit flush at the start of the resulting Store.find causes an INSERT with git_path = null.00:05
cjwatsonI was looking for some kind of filtering property on the interface field but couldn't find one.00:05
cjwatson(i.e. so that lazr.restful could do the mangling before it got as far as updateContextFromData)00:06
cjwatsonWe have various other property setters but as far as I've found so far they aren't in situations where they need to care much about the implicit flush - the problem here is that git_repository and git_path need to be set consistently with each other, but setting the latter depends on the former00:08
wgrantcjwatson: Is validating that really useful?00:14
wgrantcjwatson: It is going to be able to drift anyway.00:14
cjwatsonwgrant: Canonicalising is useful, because it makes it a lot easier to implement GitRef:+snaps.00:15
cjwatsonAnd people are likely to enter master rather than refs/heads/master00:15
wgrantcjwatson: Right, but that could just be a custom interface field.00:16
wgrantIt doesn't depend on the repository AFAICS00:16
cjwatsonI think it would be rather helpful to say that it doesn't exist if you make a typo when you try to enter it, even if it vanishes later00:16
wgrantDoing that on the API is difficult.00:17
wgrantFor the web UI I'd just have something custom in validate()00:17
cjwatsonFor form submissions I can do it in the view's validate method, and for Snap creation I can do it in SnapSet.new.  Maybe I just have to sacrifice the ability to do it on the webservice.00:17
wgrantCorrect.00:17
wgrantThe order of operations of a multi-field patch is not well-defined, and there's no way to take an action after everything is set (other than IObjectModifiedEvent)00:18
wgrantAnd doing validation in the modified event is unprecedented AFAIK.00:18
cjwatsonIf there's some way to have single-field webservice sets go through a different method than internal sets, that would be useful00:19
wgrant@mutator_for00:19
cjwatsonOho00:19
cjwatsonOf course.  That would cover more or less all the bases then00:19
wgrantI don't think you can use it :)00:19
cjwatsonWhy not?00:19
wgrantIf I'm changing the repo and path simultaneously, I may need both to change before either will validate.00:20
cjwatsonWell, only if there's a validator on the repository00:20
cjwatsonBut yes, perhaps you're right00:20
wgrantIt would seem unusual for it to be illegal to set the ref to something that doesn't exist in the repo, but legal to change the repo to one that doesn't have that ref.00:21
cjwatsonI kind of want to say that this implies that only Snap.git_ref should be exposed00:21
cjwatsonBut we decided not to do that for BMP00:21
wgrantIt was impossible for BMP as the repo references needed to remain intact even after the branch was deleted.00:22
wgrantOh00:22
wgrantCould have done a virtual one, though, I suppose.00:22
wgrantI don't recall why we didn't do that.00:22
cjwatsonI don't think I'd conceived of GitRefFrozen when we designed the BMP exports.00:23
cjwatsonMaybe.  Although I did eventually do that for BMP.00:23
wgrantIt is indeed possible not.00:23
wgrantI would continue to expose the split fields directly anyway, if only read-only, for convenience.00:23
cjwatsonThere's a good reason to continue to expose them: you might have a snap that was built from a ref that has been deleted.00:24
cjwatsonBut I'm inclined to say it should only be possible to set by the combined field.00:24
wgrantOr we could just have a named operation that sets both.00:25
cjwatsonGitRef is already exported, so I see no reason not to use it.00:25
cjwatsonBMP is partially consistent with this.  You can only create one using GitRef.createMergeProposal; but once you've created one, you can only modify it using the combined fields.00:26
cjwatsonOh, but those fields are read-only on BMP anyway.00:26
cjwatsonYou have to resubmit to change them, and resubmit isn't exposed on the webservice.00:26
wgrantAnd resubmit is a named op anyway00:27
cjwatsonSo BMP isn't as good a model as I thought it was.00:27
cjwatsonI guess the main remaining problem is that I'd need a GitRefVocabulary.00:29
cjwatsonOr maybe not, that field wouldn't be in the form.00:30
cjwatsonThis feels a lot nicer already.00:33
wgrantI dislike using object references when they are silly, but it may be best here.00:33
cjwatsonI like it when I can delete tests for whether things are canonicalised properly because there's no way to express passing in anything non-canonical.00:38
=== G_ is now known as G
cjwatsonwgrant: Did you get a chance to look at team-mail again?12:14
wgrantcjwatson: It should have a vote, unless I have too many MPs open.12:26
cjwatsonwgrant: So it does, buried in threaded mailer.  Thanks.12:49
=== danilos` is now known as danilos
lifelesscjwatson: ping (https://github.com/testing-cabal/testtools/pull/149)21:51
cjwatsonah, answered on #ubuntu-devel22:49
lifeless:)23:12

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