If a lucky person, like me, doesn't bother to read tracd --help before trying to use authentication, they will get a beautiful little traceback complaining about usage not being defined.

Attached is a little patch to fix the issue. It simply raises an OptionValueError from the optparse callback per http://www.python.org/doc/current/lib/optparse-raising-errors-in-callback.html

It's a pretty small patch, so I wasn't going to create a ticket, however, if one thinks I should, I'll be happy to do so.

This is against trunk-r2979

-John
diff -urN trac-trunk/trac/web/standalone.py trac/trac/web/standalone.py
--- trac-trunk/trac/web/standalone.py	2006-03-06 16:13:58.222414000 -0800
+++ trac/trac/web/standalone.py	2006-03-09 12:34:27.545364265 -0800
@@ -254,7 +254,8 @@
     def _auth_callback(option, opt_str, value, parser, auths, cls):
         info = value.split(',', 3)
         if len(info) != 3:
-            usage()
+             raise OptionValueError("Incorrect number of parameters for %s"
+                                    % option)
         env_name, filename, realm = info
         if env_name in auths:
             print >>sys.stderr, 'Ignoring duplicate authentication option for ' \
_______________________________________________
Trac-dev mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-dev

Reply via email to