about i#123: "rework referencing variables in filters"
Ivan Glushkov
gli.work at gmail.com
Fri Mar 23 08:16:46 PST 2007
I've just commited some changes to fix i#123 "rework referencing
variables in filters" (r1486 - r1491)
Some things that confuse me:
1.
a. Before changes: if someone calls globals.get_username(opts, db)
and current user not in db.cfg.users, function prints error message
and make sys.exit(1)
b. After changes: the same behaviour if you specify the second
parameter of get_username() (it is now not a Database object, but a
list of database users). If it isn't specified (None by default),
function doesn't check something and doesn't exit with 1 if user is
not from 'db.cfg.users' list. This check is non-obvious, and i don't
like this.
The second variant is used when we get username for command 'list'. In
this case we don't need the user to be the correct database user (we
just want to list issues, don't change smth)
2.
filters now reference to variables only with the delimiter "DT:".
Script doesn't check existence of old delimiter "$".
3.
I "used string.Template.safe_substitute()" instead of
"string.Template.substitute()" to avoid errors if some variables will
stay unreferenced in filters. It is right decision from one side: i
will be able to use ditrack even if someone wrote incorrect filter.
But from the other side we should check correctness of all our
filters, shouldn't we? (or we might just print warnings ?)
Ivan.
More information about the Dev
mailing list