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/bin/pykota

    r695 r699  
    1717# 
    1818# $Log$ 
     19# Revision 1.2  2003/02/05 22:16:20  jalet 
     20# DEVICE_URI is undefined outside of CUPS, i.e. for normal command line tools 
     21# 
    1922# Revision 1.1  2003/02/05 21:28:17  jalet 
    2023# Initial import into CVS 
     
    3437        self.username = username 
    3538        self.requester = requester.openRequester(self.config, self.printername) 
     39        self.printerhostname = self.getPrinterHostname() 
    3640     
     41    def getPrinterHostname(self) : 
     42        """Returns the printer hostname.""" 
     43        device_uri = os.environ.get("DEVICE_URI", "") 
     44        # TODO : check this for more complex urls than ipp://myprinter.dot.com:631/printers/lp 
     45        try : 
     46            (backend, destination) = device_uri.split(":", 1)  
     47        except ValueError :     
     48            raise PyKotaToolError, "Invalid DEVICE_URI : %s\n" % device_uri 
     49        while destination.startswith("/") : 
     50            destination = destination[1:] 
     51        return destination.split("/")[0].split(":")[0] 
     52         
    3753    def filterInput(self, inputfile) : 
    3854        """Transparent filter."""