Changeset 2829
- Timestamp:
- 04/04/06 11:16:53 (19 years ago)
- Location:
- pykota/trunk/bin
- Files:
-
- 12 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/cupspykota
r2803 r2829 47 47 from pykota.accounter import openAccounter 48 48 from pykota.ipp import IPPRequest, IPPError 49 from pykota.storage import PyKotaStorageError50 49 51 50 class FakeObject : 51 """Fake object.""" 52 52 def __init__(self, name) : 53 53 """Fake init.""" … … 135 135 # see if the pid contained in the lock file is still running 136 136 os.kill(pid, 0) 137 except OSError, e :138 if e .errno != errno.EPERM :137 except OSError, err : 138 if err.errno != errno.EPERM : 139 139 # process doesn't exist anymore 140 140 os.remove(lockfilename) … … 318 318 self.regainPriv() 319 319 inputfile = os.popen(jobticketcommand, "r") 320 for line in inputfile.xreadlines() : 321 line = line.strip() 322 if line in ("DENY", "AUTH=NO", "AUTH=IMPOSSIBLE") : 323 self.logdebug("Seen %s command." % line) 324 action = "DENY" 325 elif line == "CANCEL" : 326 self.logdebug("Seen CANCEL command.") 327 action = "CANCEL" 328 elif line.startswith("USERNAME=") : 329 username = line.split("=", 1)[1].strip() 330 self.logdebug("Seen new username [%s]" % username) 331 elif line.startswith("BILLINGCODE=") : 332 billingcode = line.split("=", 1)[1].strip() 333 self.logdebug("Seen new billing code [%s]" % billingcode) 320 try : 321 for line in inputfile.xreadlines() : 322 line = line.strip() 323 if line in ("DENY", "AUTH=NO", "AUTH=IMPOSSIBLE") : 324 self.logdebug("Seen %s command." % line) 325 action = "DENY" 326 elif line == "CANCEL" : 327 self.logdebug("Seen CANCEL command.") 328 action = "CANCEL" 329 elif line.startswith("USERNAME=") : 330 username = line.split("=", 1)[1].strip() 331 self.logdebug("Seen new username [%s]" % username) 332 elif line.startswith("BILLINGCODE=") : 333 billingcode = line.split("=", 1)[1].strip() 334 self.logdebug("Seen new billing code [%s]" % billingcode) 335 except IOError, msg : 336 self.logdebug("IOError while reading subprocess' output : %s" % msg) 334 337 inputfile.close() 335 338 self.dropPriv() … … 452 455 453 456 class DummyClass : 457 """Class used to avoid errors.""" 454 458 operation_attributes = {} 455 459 job_attributes = {} … … 1254 1258 wrapper.printInfo(_("Job %s interrupted by the administrator !") % wrapper.JobId, "warn") 1255 1259 retcode = 0 1256 except SystemExit, e :1257 retcode = e .code1260 except SystemExit, err : 1261 retcode = err.code 1258 1262 except : 1259 1263 try : -
pykota/trunk/bin/dumpykota
r2622 r2829 26 26 27 27 import sys 28 import os29 28 30 from pykota import version 31 from pykota.tool import PyKotaToolError, PyKotaCommandLineError, crashed, N_ 29 from pykota.tool import PyKotaCommandLineError, crashed, N_ 32 30 from pykota.dumper import DumPyKota 33 31 -
pykota/trunk/bin/edpykota
r2789 r2829 26 26 27 27 import sys 28 import os 29 30 from pykota.tool import Percent, PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 31 from pykota.config import PyKotaConfigError 32 from pykota.storage import PyKotaStorageError, StorageUserPQuota, StorageGroupPQuota 28 29 from pykota.tool import Percent, PyKotaTool, PyKotaCommandLineError, crashed, N_ 30 from pykota.storage import StorageUserPQuota, StorageGroupPQuota 33 31 34 32 __doc__ = N_("""edpykota v%(__version__)s (c) %(__years__)s %(__author__)s -
pykota/trunk/bin/pkbcodes
r2789 r2829 29 29 import pwd 30 30 31 from pykota.tool import Percent, PyKotaTool, PyKota ToolError, PyKotaCommandLineError, crashed, N_31 from pykota.tool import Percent, PyKotaTool, PyKotaCommandLineError, crashed, N_ 32 32 from pykota.storage import StorageBillingCode 33 33 -
pykota/trunk/bin/pkmail
r2622 r2829 31 31 import email 32 32 33 from pykota.tool import PyKotaTool, PyKota ToolError, PyKotaCommandLineError, crashed, N_33 from pykota.tool import PyKotaTool, PyKotaCommandLineError, crashed, N_ 34 34 35 35 __doc__ = N_("""pkmail v%(__version__)s (c) %(__years__)s %(__author__)s -
pykota/trunk/bin/pknotify
r2825 r2829 26 26 27 27 import sys 28 import os29 import popen230 28 import socket 31 29 import signal … … 39 37 hasPAM = 1 40 38 41 from pykota.tool import Tool, PyKota ToolError, PyKotaCommandLineError, crashed, N_39 from pykota.tool import Tool, PyKotaCommandLineError, crashed, N_ 42 40 43 41 __doc__ = N_("""pknotify v%(__version__)s (c) %(__years__)s %(__author__)s -
pykota/trunk/bin/pkprinters
r2789 r2829 29 29 import pwd 30 30 31 from pykota.tool import Percent, PyKotaTool, PyKota ToolError, PyKotaCommandLineError, crashed, N_31 from pykota.tool import Percent, PyKotaTool, PyKotaCommandLineError, crashed, N_ 32 32 from pykota.storage import StoragePrinter 33 33 … … 227 227 if self.isValidName(pname) : 228 228 printer = StoragePrinter(self.storage, pname) 229 self.modifyPrinter(printer, charges, perpage, perjob, \229 self.modifyPrinter(printer, charges, perpage, perjob, \ 230 230 description, passthrough, \ 231 231 nopassthrough, maxjobsize) -
pykota/trunk/bin/pkturnkey
r2745 r2829 223 223 try : 224 224 from pysnmp.asn1.encoding.ber.error import TypeMismatchError 225 from pysnmp.mapping.udp.error import SnmpOverUdpError226 225 from pysnmp.mapping.udp.role import Manager 227 226 from pysnmp.proto.api import alpha … … 247 246 tsp.close() 248 247 249 def handleAnswer(whole Msg, notusedhere, req):248 def handleAnswer(wholemsg, notusedhere, req): 250 249 """Decodes and handles the SNMP answer.""" 251 250 ver = alpha.protoVersions[alpha.protoVersionId1] 252 251 rsp = ver.Message() 253 252 try : 254 rsp.berDecode(whole Msg)253 rsp.berDecode(wholemsg) 255 254 except TypeMismatchError, msg : 256 255 raise "No SNMP !" … … 364 363 """Intializes PyKota's database.""" 365 364 if not self.config.isAdmin : 366 raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], \365 raise PyKotaCommandLineError, "%s : %s" % (pwd.getpwuid(os.geteuid())[0], \ 367 366 _("You're not allowed to use this command.")) 368 367 -
pykota/trunk/bin/pkusers
r2792 r2829 25 25 # 26 26 27 import os28 27 import sys 29 28 import pwd 30 29 import grp 31 30 32 from pykota.tool import Percent, PyKotaTool, PyKota ToolError, PyKotaCommandLineError, crashed, N_31 from pykota.tool import Percent, PyKotaTool, PyKotaCommandLineError, crashed, N_ 33 32 from pykota.storage import StorageUser, StorageGroup 34 33 -
pykota/trunk/bin/pykosd
r2692 r2829 79 79 80 80 class PyKOSD(PyKotaTool) : 81 """A class for an On Screen Display print quota monitor.""" 81 82 def main(self, args, options) : 82 83 """Main function starts here.""" -
pykota/trunk/bin/pykotme
r2622 r2829 29 29 import pwd 30 30 31 from pykota.tool import PyKotaTool, PyKota ToolError, PyKotaCommandLineError, crashed, N_31 from pykota.tool import PyKotaTool, PyKotaCommandLineError, crashed, N_ 32 32 33 33 try : -
pykota/trunk/bin/warnpykota
r2692 r2829 29 29 import pwd 30 30 31 from pykota.tool import PyKotaTool, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 32 from pykota.config import PyKotaConfigError 33 from pykota.storage import PyKotaStorageError 31 from pykota.tool import PyKotaTool, PyKotaCommandLineError, crashed, N_ 34 32 35 33 __doc__ = N_("""warnpykota v%(__version__)s (c) %(__years__)s %(__author__)s