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

blrwgrant: afaict, the GitHostingClient is only called by the XmlRpcApi currently?01:31
wgrantblr: Yep, you can currently only create a repository by trying to push it.01:38
wgrantturnip makes the translatePath XML-RPC call. LP notices that it doesn't exist and creates it, calling back into turnip (while being called from turnip) to create the repository on disk before returning its path.01:38
blrwgrant: am I right in thinking GitRepository.destroySelf() only needs to call turnip from the api client?01:55
blrwgrant: are we preserving the model in the db, but setting a deleted flag?02:00
wgrantblr: At the moment we'll delete the LP database row too.02:14
wgrantblr: There's no reason to do complicated deferred deletion just yet.02:14
wgrant(LP has a history of not actually deleting things, which causes no end of trouble. We should design for proper deletion from the start here.)02:16
blrwgrant: ok, thanks02:16
=== mup_ is now known as mup
blrwgrant: class StupidCache()02:44
blralso enjoyed the lolcat interfaces.02:48
wgrantYup, StupidCache is the cache that remembers everything it's ever seen.02:50
blrcjwatson: thanks for the comments re UTF-8 filtering, agree that it makes sense to handle it there.18:54
blrcjwatson: the merge conflict was from providing a dependant branch on the MP, it doesn't exist in my local branch - how can I avoid that in the future?18:56
blrcjwatson: also noted the style for decorators in LP appears to be func_name_decorator, will amend that as well.19:02
blrcjwatson: wgrant: meeting today or tomorrow? (tomorrow in calendar, but we seem to have been shifting back a day recently)20:37
cjwatsonblr: you know about the prerequisite branch facility in merge proposals?21:18
cjwatsonOh, wait, you are using that.  So then I don't understand why that requires you to have conflicts21:19
cjwatsonblr: I doubt it has much to do with the dependent branch; it probably just means you need to merge lp:turnip into your branch, resolve conflicts, and push21:19
blrcjwatson: ok, that makes sense.21:20
wgrantMorning.21:36
wgrantcjwatson: Pre-reqs can in some circumstances confuse bzr merge into generating more conflicts, but I've only seen it rarelyt.21:37
cjwatsonwgrant: Not on the underlay branch, surely?21:37
wgrantAh, no.21:39
wgrantMisread that.21:39
blrcjwatson: would json.dumps(foo, encoding='utf8') be better than ensure_ascii=False?22:08
cjwatsonencoding="utf-8" is the default22:09
blrah so it is22:09
wgrantAnyone encoding JSON as anything else should be shot :)22:09
cjwatsonThe default escaping is just so that it works conveniently over file objects open in binary mode; I would *hope* cornice can cope with unicode, just haven't checked22:10
wgrantHum22:11
blrcjwatson: yes it appears to22:11
wgrantencoding='utf8' isn't the default, is it?22:12
wgrantensure_ascii=False leaves it as a unicode.22:12
wgrant(but cornice should know to encode that as UTF-8)22:12
cjwatsons'what https://docs.python.org/2/library/json says22:12
cjwatsonprobably encoding only takes effect if ensure_ascii=True22:13
wgrant    If ``ensure_ascii`` is false, all non-ASCII characters are not escaped, and22:13
wgrant    the return value may be a ``unicode`` instance. See ``dump`` for details.22:13
wgrantIf ensure_ascii is true, they're escaped.22:13
wgrantNot encoded.22:13
wgrantI wonder if encoding= is only useful for charsets that don't match ASCII.22:14
wgrantI think encoding is meaningless with ensure_ascii=False, because it doesn't encode at all.22:14
cjwatsonfrom a quick look at the code, I think it's actually used for decoding str objects you pass *in*22:14
wgrantAh, that might make sense.22:14
wgrantIt might also be relevant if eg. you use ensure_ascii=True and want EBCDIC output.22:15
cjwatsonand if it's not 'utf-8' then it interposes a decoder22:15
wgrantNo, that still doesn't work.22:15
cjwatsonso encoding='utf8' is not actually quite the same as encoding='utf-8' here, potentially ... .encode and .decode have always hurt my brain22:15
cjwatsonI'd leave encoding= well alone :)22:15
cjwatsonI think if you want differently-encoded output you have to set the encoding on the file object and use json.dump(ensure_ascii=False), or use json.dumps(ensure_ascii=False).encode()22:16
blrtests pass with ensure_ascii=False at any rate22:17
wgrantYep, ensure_ascii=False is usually the write way to go for web stuff, since HTTP can handle the charset itself.22:17
cjwatsonThat's probably only meaningful if you've specifically added tests with non-ASCII data.22:17
cjwatsonAt least in Python 2 where you get the "helpful" default of unicode->str working magically until something outside ASCII appears.22:18
blrso presumably I need a test with some latin1 data, or something of the sort22:19
cjwatsonRight, I'd add one with ISO-8859-1 or something that's not valid UTF-8, and one with valid UTF-8.22:19
cjwatsonAnd make sure that neither crashes, but that the former ref is silently omitted (so maybe have another valid UTF-8 ref in there as well or something)22:20
blrcjwatson: with the ref collection I can silently omit refs unable to encode, but I think we'll also want a validator on get() which returns a 400 perhaps?22:21
wgrantAre Pyramid's paths bytestrings or Unicode strings?22:22
wgrantLP's are pretty much treated as Unicode, so the ref wouldn't make it through the traversal logic.22:22
wgrantturnip-api should probably 404 if it fails to decode a path as UTF-8.22:23
blrwgrant: they're unicode22:23
cjwatsonI think I would prefer 400 ("could not be understood by the server due to malformed syntax"), but either works.22:24
cjwatsonHopefully Pyramid already handles it ...22:24
wgrantSome frameworks do weird things, so we should probably check that.22:25
blrcjwatson: a test should confirm either way22:25
blrit would be nice not to need an explicit validator there.22:25
cjwatsonhttp://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/views.html#handling-form-submissions-in-view-callables-unicode-and-character-set-issues has some stuff about this22:26
cjwatsonBut certainly we should check22:26
cjwatsonHm, that link is about form submissions rather than things like the path, though22:27
blrprobably still applicable22:27
cjwatsonmaaaaybe22:27
blrheh22:27
cjwatsonhttp://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/urldispatch.html "Note that values representing matched path segments will be url-unquoted and decoded from UTF-8 into Unicode within the matchdict."22:28
wgrantYay, so it's sane.22:28
wgrantBut I wonder what it does on failure.22:28
blryes self.request.matchdict['ref'] is unicode22:29
cjwatsonYeah, can't immediately find that in the docs22:29
wgrantIt's pretty modern and Zopey, so it's unlikely to be completely moronic.22:29
wgrantBut it's not unheardof for frameworks to return a str if things don't decode properly...22:29
cjwatsonLooks like it raises URLDecodeError, and you can register an exception view for that if you want custom behaviour.  Don't know what the default is.22:37
wgrantRight, it probably does something sensible then.22:38
wgrantcjwatson: So meeting in 24 hours?22:39
cjwatsonAnd a bit, yeah.22:39

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