While trying to debug an encoding problem in Cicero, I ended up digging into OMGeo again, and in the process discovered that just trying to examine the geocoder settings caused an error from postprocessors.py:
TypeError: not enough arguments for format string
Looks like the AttrListIncludes and AttrListExcludes filter classes were based off similar ones that had one additional parameter.
So this fixes that, and also:
Changes .decode() calls to explicitly specify "utf-8" rather than rely on the default, which could potentially cause problems, as noted by @ddohler on PR #61
Adds a non-ASCII character to the test address in the CancelIfRegexInAttr tests, since it's easier for problems to slip through the cracks if all the strings are ASCII-compatible.
None of this is urgent--the Cicero issue turned out not to implicate this package after all--but it might as well go in.
Testing
In a Python shell, run:
from omgeo.postprocessors import AttrListExcludes
AttrListExcludes(["foo"], "bar")
With these changes it will print <AttrListExcludes: bar in ['foo']>. Without, it will crash.
./test.sh should succeed as before.
I don't know of a way to test the explicit decode argument. As noted in the linked comment, we didn't manage to actually get something to break because of the default encoding.
While trying to debug an encoding problem in Cicero, I ended up digging into OMGeo again, and in the process discovered that just trying to examine the geocoder settings caused an error from
postprocessors.py
:Looks like the
AttrListIncludes
andAttrListExcludes
filter classes were based off similar ones that had one additional parameter.So this fixes that, and also:
.decode()
calls to explicitly specify"utf-8"
rather than rely on the default, which could potentially cause problems, as noted by @ddohler on PR #61CancelIfRegexInAttr
tests, since it's easier for problems to slip through the cracks if all the strings are ASCII-compatible.None of this is urgent--the Cicero issue turned out not to implicate this package after all--but it might as well go in.
Testing
With these changes it will print
<AttrListExcludes: bar in ['foo']>
. Without, it will crash../test.sh
should succeed as before.decode
argument. As noted in the linked comment, we didn't manage to actually get something to break because of the default encoding.