Show
Ignore:
Timestamp:
02/05/03 23:16:20 (21 years ago)
Author:
jalet
Message:

DEVICE_URI is undefined outside of CUPS, i.e. for normal command line tools

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/tool.py

    r698 r699  
    1515# 
    1616# $Log$ 
     17# Revision 1.3  2003/02/05 22:16:20  jalet 
     18# DEVICE_URI is undefined outside of CUPS, i.e. for normal command line tools 
     19# 
    1720# Revision 1.2  2003/02/05 22:10:29  jalet 
    1821# Typos 
     
    4952        self.storage = storage.openConnection(self.config, asadmin=(not isfilter)) 
    5053        self.printername = os.environ.get("PRINTER", None) 
    51         self.printerhostname = self.getPrinterHostname() 
    5254        self.smtpserver = self.config.getSMTPServer() 
    5355        self.admin = self.config.getAdmin() 
     
    7173        self.sendMessage(self.adminmail, "Subject: %s\n\n%s" % (subject, message)) 
    7274         
    73     def getPrinterHostname(self) : 
    74         """Returns the printer hostname.""" 
    75         device_uri = os.environ.get("DEVICE_URI", "") 
    76         # TODO : check this for more complex urls than ipp://myprinter.dot.com:631/printers/lp 
    77         try : 
    78             (backend, destination) = device_uri.split(":", 1)  
    79         except ValueError :     
    80             raise PyKotaToolError, "Invalid DEVICE_URI : %s\n" % device_uri 
    81         while destination.startswith("/") : 
    82             destination = destination[1:] 
    83         return destination.split("/")[0].split(":")[0] 
    84          
    8575    def warnQuotaPrinter(self, username) : 
    8676        """Checks a user quota and send him a message if quota is exceeded on current printer."""