[PATCH 7 of 7] templatefilters: document json filter that requires UTF-8 bytes

Yuya Nishihara yuya at tcha.org
Mon Mar 14 09:40:42 EDT 2016


On Fri, 11 Mar 2016 14:05:26 -0500, timeless wrote:
> I roughly meant that I don't know the details of what |json does /
> what we want it to do / how much testing we have to verify it does
> what we want it to do.

- what |json does:
  serialize an input object as JSON

- what we want it to do:
  (AFAIK) serialize an input object as JSON without loosing non-UTF8 bytes

- how much testing we have to verify it does what we want it to do:
  I think encoding handling is well tested thanks to a couple of bugs found
  by Hypothesis. But handling of non-trivial types (e.g. a _hybrid object)
  seems not tested well.

> > The current version does no encoding conversion.
> 
> afaik, it would be possible to add an optional argument to json()
> which wouldn't break the behavior of |json, right?
> If so, then I don't think that an optional encoding thing blocks
> moving forward w/ |json.

Yep, we can change it to a template function and add an optional parameter
if we want.

So, "encoding" won't be a blocker. Do anybody remember why "|json" wasn't
documented?


More information about the Mercurial-devel mailing list