[25629] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r25135 - in trunk/debathena/config/printing-config: debathena/printing debian

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Tue Jun 14 15:43:44 2011

Date: Tue, 14 Jun 2011 15:43:38 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201106141943.p5EJhcZU013620@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jdreed
Date: 2011-06-14 15:43:37 -0400 (Tue, 14 Jun 2011)
New Revision: 25135

Modified:
   trunk/debathena/config/printing-config/debathena/printing/simple.py
   trunk/debathena/config/printing-config/debian/changelog
Log:
In printing-config:
  * Don't barf on unexpected args (Trac #719)


Modified: trunk/debathena/config/printing-config/debathena/printing/simple.py
===================================================================
--- trunk/debathena/config/printing-config/debathena/printing/simple.py	2011-06-14 17:02:14 UTC (rev 25134)
+++ trunk/debathena/config/printing-config/debathena/printing/simple.py	2011-06-14 19:43:37 UTC (rev 25135)
@@ -10,6 +10,8 @@
 
 import os
 import sys
+import string
+import re
 
 from debathena.printing import common
 
@@ -19,7 +21,15 @@
 
     queue = common.get_default_printer()
     try:
-        argstyle, options, arguments = common.parse_args(args, optinfo)
+        parseresult = common.parse_args(args, optinfo)
+        if parseresult == None:
+            # Don't barf if neither CUPS nor LPRng syntax was valid (and
+            # hence parse_args returns None)
+            # Remove this stupidity when we kill LPRng with fire
+            print "Syntax Error: Incorrect option passed."
+            print "Valid options: " + string.replace(re.sub(r'([a-zA-Z])',r'-\1 ',optinfo[common.SYSTEM_CUPS][1]), ':', '[arg] ')
+            sys.exit(2)
+        argstyle, options, arguments = parseresult
 
         # Find the last queue specified in the arguments
         queue_args, options = common.extract_opt(options, queue_opt)

Modified: trunk/debathena/config/printing-config/debian/changelog
===================================================================
--- trunk/debathena/config/printing-config/debian/changelog	2011-06-14 17:02:14 UTC (rev 25134)
+++ trunk/debathena/config/printing-config/debian/changelog	2011-06-14 19:43:37 UTC (rev 25135)
@@ -1,3 +1,9 @@
+debathena-printing-config (1.23.3) unstable; urgency=low
+
+  * Don't barf on unexpected args (Trac #719)
+
+ -- Jonathan Reed <jdreed@mit.edu>  Tue, 14 Jun 2011 15:41:41 -0400
+
 debathena-printing-config (1.23.2) unstable; urgency=low
 
   * Test system and argstyle, when adding zephyr args so as not to break


home help back first fref pref prev next nref lref last post