Changeset 699 for pykota/trunk
- Timestamp:
- 02/05/03 23:16:20 (22 years ago)
- Location:
- pykota/trunk
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pykota
r695 r699 17 17 # 18 18 # $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 # 19 22 # Revision 1.1 2003/02/05 21:28:17 jalet 20 23 # Initial import into CVS … … 34 37 self.username = username 35 38 self.requester = requester.openRequester(self.config, self.printername) 39 self.printerhostname = self.getPrinterHostname() 36 40 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 37 53 def filterInput(self, inputfile) : 38 54 """Transparent filter.""" -
pykota/trunk/pykota/tool.py
r698 r699 15 15 # 16 16 # $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 # 17 20 # Revision 1.2 2003/02/05 22:10:29 jalet 18 21 # Typos … … 49 52 self.storage = storage.openConnection(self.config, asadmin=(not isfilter)) 50 53 self.printername = os.environ.get("PRINTER", None) 51 self.printerhostname = self.getPrinterHostname()52 54 self.smtpserver = self.config.getSMTPServer() 53 55 self.admin = self.config.getAdmin() … … 71 73 self.sendMessage(self.adminmail, "Subject: %s\n\n%s" % (subject, message)) 72 74 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/lp77 try :78 (backend, destination) = device_uri.split(":", 1)79 except ValueError :80 raise PyKotaToolError, "Invalid DEVICE_URI : %s\n" % device_uri81 while destination.startswith("/") :82 destination = destination[1:]83 return destination.split("/")[0].split(":")[0]84 85 75 def warnQuotaPrinter(self, username) : 86 76 """Checks a user quota and send him a message if quota is exceeded on current printer."""