<nick> no image preview, but it works for logged out users
<nick> i guess I can just copy images and paste them into Slack
<nick> that works...
hslack has quit
hslack joined the channel
badon joined the channel
<seanh> I'm not seeing any way to customize the error messages like "Shorter than minimum length 3" that Deform/Colander returns. It looks like doing a regex against the error message and transforming it might be the only way..
<nick> @seanh: really? that seems unlikely...
<nick> I mean, I presume deform/colander have some kind of I18N support, so I doubt the error messages are hard-coded as English and not overrideable.
<seanh> Oh no just found it
<seanh> You can pass custom ones in
<seanh> Oh you can l10n the errors, colander marks them in a gettext compatible way, but I don't think that would be quite right for what I'm trying to do
<nick> no, I wasn't suggesting that
<nick> I was just pointing out that if the error messages were hardcoded, that would make localisation really difficult
<seanh> Anyway, you can pass in args to the colander nodes to change the error message templates
<nick> :+1:
hslack has quit
hslack joined the channel
<nick> I'm just looking into how we handle CSRF tokens in the client, with a view to removing the `assertion` parameter from the token endpoint (this blocks us moving to Pyramid 1.7, which blocks a couple of other things)
<nick> unsurprisingly, it's a bit of a mess
<nick> in theory, Angular has some magic which manages this all for us
<nick> you set a `XSRF-TOKEN` cookie, readable from JavaScript, and then on unsafe requests (POST/PUT/etc.) angular will put the value of that cookie back into the `X-XSRF-TOKEN` header
<nick> @lenazun I think we have a PR open for that
<nick> @sheetaluk was working on the other half of it, though
<nick> and I don't know where that got to
<seanh> Something odd going on with Deform/Colander. I added a `min_err="Must be longer than ${min} characters."` arg to the `colander.Length` validator. Now the error message gets rendered as `(u'Must be longer than 3 characters.',)` in the HTML (i.e. someone as done `str()` on a tuple). Simply removing the `min_err` arg fixes this though - it's adding a `min_err` that seems to cause the error. Debugging, `h.form.Jinja2
`kwargs['field'].error.asdict()` returning `{'username': u"(u'Must be longer than 3 characters.',)"}`. So, it seems to be a bug in Colander or Deform? It doesn't appear to be _us_ that stringifies a tuple
<robertknight> We have a PR open that fixes one part. @sheetaluk is indeed working on the other part
<robertknight> We should be able to sort it in the next couple of days
<seanh> All we do is call `self.form.render()` quite innocently in our view function. The call stack then passes through deform which calls our Jinja2Renderer passing it the bad value. So either deform has a bug at that point, or something else already went wrong before then. Gonna have to debug deform