m-lab/operator — pull request #20 by stephen-soltesz (2013-10-17 02:11:24+00:00)
Title: gdict format fix

Python supports two types of string formatting conventions for dict's:
* old style using: `"%(keyname)s" % dict`
* new style using: `"{keyname}".format(keyname=value)`

The original version of gdict.py used the new-style, because it is supported natively by the string.format() method, and the `{}` syntax is easier to read.

The column names provided to gdict are user-provided. And, the keyname=value arguments to format() were provided by `.format(**args)`. This limits keynames to valid python identifiers only. This excludes column names like "site.host" or "foo-bar".

To support these and keep the new-style syntax, this patch replaces `{}` using string substitution with the old-style syntax `%()s`. The usage() string also includes a note on reserved characters now.