dimagi/commcare-hq — pull request #4643 by esoergel (2014-10-29 10:47:53+00:00)
Title: Fix assert statement for ESQuery faceting

@TylerSheffels @czue @snopoke regarding https://github.com/dimagi/commcare-hq/pull/4637 and https://github.com/dimagi/commcare-hq/pull/4635
This code does some dynamic assignment, which is why that name must be a valid python variable name. I used an assert statement here to raise an exception where the wrong name is used, rather than when the dynamic assignment is made, so it's clearer where the problem is.

Because the assert statement was previously broken, code got in which didn't fit this model, but it never raised an issue because that dynamic assignment was never called on that code.

This whole model might be a bit too clever for its own good. I'll do a design review soon on this stuff, as that's one thing I've thought about changing.