Fix TypeError by matching format modifier and param count
Silence harmless linter warning: undefined name 'previous'
Fix indent in dbaccess.py
Switch to modern raise syntax

This commit was machine generated using:
2to3 -wn -f raise .

...and then reviewed manually.
Don't assign 'value' since it's not used
Switch to modern except syntax

This commit was machine generated using:
2to3 -wn -f except .

...and then reviewed manually.
Drop unused imports

This is like a game of Mikado in the sense that it's
slightly pointless but still a somewhat amusing pastime.
Now, how many can we remove before stuff breaks?
Simplify code to convince linter that mail_handler is defined
Drop unused locals
Avoid assigned-but-not-used "changes"

Changes is assigned and used later on but this assignment is redundant.
Use unused param "profiling" in Cursor.__init__()
Delete redundant copy of clexer.py (real one is in src/syntaxhighlight dir)
Drop redundant "expected" in error message

Before this fix, when navigating to "/r/a" it said:
Got 'id=a', expected expected integer.
Fix error handling of invalid filter_id on /config