[26602] in Source-Commits

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

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

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Thu Jul 19 12:00:48 2012

Date: Thu, 19 Jul 2012 12:00:45 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201207191600.q6JG0jG6005303@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jdreed
Date: 2012-07-19 12:00:44 -0400 (Thu, 19 Jul 2012)
New Revision: 25646

Modified:
   trunk/debathena/config/printing-config/debathena/printing/common.py
   trunk/debathena/config/printing-config/debian/changelog
Log:
In printing-config:
  * Don't ignore local cluster info when getting the default printer
    (Trac: #1032)


Modified: trunk/debathena/config/printing-config/debathena/printing/common.py
===================================================================
--- trunk/debathena/config/printing-config/debathena/printing/common.py	2012-07-19 15:40:58 UTC (rev 25645)
+++ trunk/debathena/config/printing-config/debathena/printing/common.py	2012-07-19 16:00:44 UTC (rev 25646)
@@ -8,7 +8,7 @@
 import urllib
 import string
 import re
-
+import subprocess
 import cups
 import hesiod
 
@@ -153,12 +153,24 @@
         if default:
             return default
 
-    for result in _hesiod_lookup(socket.getfqdn(), 'cluster'):
-        key, value = result.split(None, 1)
-        if key == 'lpr':
-            return value
+    hesprinter = subprocess.Popen("eval $(getcluster -b $(lsb_release -sr)) && echo $LPR", stdout=subprocess.PIPE, shell=True).communicate()[0]
+    if hesprinter:
+        return hesprinter.strip()
 
 
+def is_local(queue):
+    """Determine if a queue is local or not
+
+    Args:
+      The name of a print queue
+
+    Return:
+      True if the queue is defined in whatever the default CUPS
+      daemon is, False otherwise
+    """
+    _setup()
+    return queue in [dest(0) for dest in cupsd.getDests()]
+
 def canonicalize_queue(queue):
     """Canonicalize local queue names to Athena queue names
 

Modified: trunk/debathena/config/printing-config/debian/changelog
===================================================================
--- trunk/debathena/config/printing-config/debian/changelog	2012-07-19 15:40:58 UTC (rev 25645)
+++ trunk/debathena/config/printing-config/debian/changelog	2012-07-19 16:00:44 UTC (rev 25646)
@@ -1,10 +1,12 @@
-debathena-printing-config (1.29) UNRELEASED; urgency=low
+debathena-printing-config (1.29) unstable; urgency=low
 
   * Bump debian/compat to 6
   * Be verbose about whether add-athena-printer completed and explain to
     users that they can select a different/better PPD
+  * Don't ignore local cluster info when getting the default printer
+    (Trac: #1032)
 
- -- Jonathan Reed <jdreed@mit.edu>  Fri, 06 Jul 2012 08:48:22 -0400
+ -- Jonathan Reed <jdreed@mit.edu>  Thu, 19 Jul 2012 12:00:15 -0400
 
 debathena-printing-config (1.28) unstable; urgency=low
 


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