Changeset 3549 for pykota/trunk/bin/edpykota
- Timestamp:
- 08/18/10 04:20:57 (14 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r3489 r3549 36 36 class EdPyKota(PyKotaTool) : 37 37 """A class for edpykota.""" 38 def modifyPQEntry(self, pqkey, pqentry, noquota, softlimit, hardlimit, increase, reset, hardreset, suffix, used ) :38 def modifyPQEntry(self, pqkey, pqentry, noquota, softlimit, hardlimit, increase, reset, hardreset, suffix, used, maxjobsize) : 39 39 """Modifies a print quota entry.""" 40 40 if noquota or ((softlimit is not None) and (hardlimit is not None)) : … … 54 54 if used : 55 55 pqentry.setUsage(used) 56 if maxjobsize is not None : 57 if maxjobsize == "unlimited" : 58 pqentry.setMaxJobSize(None) 59 else : 60 pqentry.setMaxJobSize(maxjobsize) 56 61 57 62 def main(self, names, options) : … … 77 82 or options.noquota \ 78 83 or options.increase \ 84 or options.maxjobsize \ 79 85 or options.skipexisting))) \ 80 86 or (options.groups and (options.used \ 87 or options.maxjobsize \ 81 88 or options.increase \ 82 89 or options.reset \ … … 106 113 self.display(" %s\n" % (_("Hard limit : %s") % pqentry.HardLimit)) 107 114 self.display(" %s\n" % (_("Date limit : %s") % pqentry.DateLimit)) 108 self.display(" %s (Not supported yet)\n" % (_("Maximum job size : %s") % ((pqentry.MaxJobSize and (_("%s pages") % pqentry.MaxJobSize)) or _("Unlimited")))) 115 if suffix == "User" : 116 self.display(" %s\n" % (_("Maximum job size : %s") % (((pqentry.MaxJobSize is not None) and (_("%s pages") % pqentry.MaxJobSize)) or _("Unlimited")))) 109 117 if hasattr(pqentry, "WarnCount") : 110 118 self.display(" %s\n" % (_("Warning banners printed : %s") % pqentry.WarnCount)) … … 159 167 self.printInfo(_("Undefined soft limit set to hard limit (%s).") % str(softlimit)) 160 168 169 if options.maxjobsize : 170 if options.maxjobsize.lower() == "unlimited" : 171 maxjobsize = "unlimited" 172 else : 173 try : 174 maxjobsize = int(options.maxjobsize) 175 if maxjobsize < 0 : 176 raise ValueError 177 except ValueError : 178 raise PyKotaCommandLineError, _("Invalid maximum job size value %s") % options.maxjobsize 179 else : 180 maxjobsize = None 181 161 182 self.storage.beginTransaction() 162 183 try : … … 183 204 options.hardreset, 184 205 suffix, 185 used) 206 used, 207 maxjobsize) 186 208 oldpqentry = getattr(self.storage, "add%sPQuota" % suffix)(pqentry) 187 209 if oldpqentry is not None : … … 201 223 options.hardreset, 202 224 suffix, 203 used) 225 used, 226 maxjobsize) 204 227 oldpqentry.save() 205 228 percent.oneMore() … … 220 243 options.hardreset, 221 244 suffix, 222 used) 245 used, 246 maxjobsize) 223 247 pqentry.save() 224 248 percent.oneMore() … … 263 287 dest="action", 264 288 help=_("Display detailed informations about the specified users or groups print quota entries.")) 289 parser.add_option("-m", "--maxjobsize", 290 dest="maxjobsize", 291 help=_("Set the maximum job size in pages the specified users are allowed to print to the specified printers in a single job. Accepted values are '0' to forbid printing, 'unlimited' to allow unrestricted printing, or any positive integer value. This option is not supported for users groups.")) 265 292 parser.add_option("-n", "--noquota", 266 293 dest="noquota",