Show
Ignore:
Timestamp:
08/18/10 04:20:57 (14 years ago)
Author:
jerome
Message:

Removed support for the MaxJobSize? attribute for users group print quota
entries : I couldn't see a real use for this at the moment, and it would
complexify the code. This support might reappear later however. Added full
support for the MaxJobSize? attribute for user print quota entries,
editable with edpykota's new --maxjobsize command line switch. Changed
the internal handling of the MaxJobSize? attribute for printers :
internally 0 used to mean unlimited, it now allows one to forbid
printing onto a particular printer. The database upgrade script (only
for PostgreSQL) takes care of this.
IMPORTANT : the database schema changes. A database upgrade script is
provided for PostgreSQL only. The LDAP schema doesn't change to not
break any existing LDAP directory, so the pykotaMaxJobSize attribute is
still allowed on group print quota entries, but never used.
Seems to work as expected, for a change :-)
Fixes #15.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pkprinters

    r3489 r3549  
    5050            printer.setPassThrough(True) 
    5151        if maxjobsize is not None : 
    52             printer.setMaxJobSize(maxjobsize) 
     52            if maxjobsize == "unlimited" : 
     53                printer.setMaxJobSize(None) 
     54            else : 
     55                printer.setMaxJobSize(maxjobsize) 
    5356 
    5457    def managePrintersGroups(self, pgroups, printer, remove) : 
     
    151154                                     (_("Passthrough mode : %s") % ((printer.PassThrough and _("ON")) or _("OFF")))) 
    152155                self.display("    %s\n" % \ 
    153                                      (_("Maximum job size : %s") % ((printer.MaxJobSize and (_("%s pages") % printer.MaxJobSize)) or _("Unlimited")))) 
     156                                     (_("Maximum job size : %s") % (((printer.MaxJobSize is not None) and (_("%s pages") % printer.MaxJobSize)) or _("Unlimited")))) 
    154157                self.display("    %s\n" % (_("Routed through PyKota : %s") % ((self.isPrinterCaptured(printer.Name) and _("YES")) or _("NO")))) 
    155158                if parents : 
     
    188191 
    189192            if options.maxjobsize : 
    190                 try : 
    191                     maxjobsize = int(options.maxjobsize) 
    192                     if maxjobsize < 0 : 
    193                         raise ValueError 
    194                 except ValueError : 
    195                     raise PyKotaCommandLineError, _("Invalid maximum job size value %s") % options.maxjobsize 
     193                if options.maxjobsize.lower() == "unlimited" : 
     194                    maxjobsize = "unlimited" 
     195                else : 
     196                    try : 
     197                        maxjobsize = int(options.maxjobsize) 
     198                        if maxjobsize < 0 : 
     199                            raise ValueError 
     200                    except ValueError : 
     201                        raise PyKotaCommandLineError, _("Invalid maximum job size value %s") % options.maxjobsize 
    196202            else : 
    197203                maxjobsize = None 
     
    306312    parser.add_option("-m", "--maxjobsize", 
    307313                            dest="maxjobsize", 
    308                             help=_("Set the maximum job size in pages allowed on the specified printers.")) 
     314                            help=_("Set the maximum job size in pages allowed on the specified printers. Accepted values are '0' to forbid printing, 'unlimited' to allow unrestricted printing, or any positive integer value.")) 
    309315    parser.add_option("-n", "--nopassthrough", 
    310316                            action="store_true",