Changeset 763 for pykota/trunk/bin

Show
Ignore:
Timestamp:
02/08/03 23:09:02 (22 years ago)
Author:
jalet
Message:

Only printer was added the first time.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/edpykota

    r762 r763  
    1717# 
    1818# $Log$ 
     19# Revision 1.13  2003/02/08 22:09:02  jalet 
     20# Only printer was added the first time. 
     21# 
    1922# Revision 1.12  2003/02/08 21:44:49  jalet 
    2023# Python 2.1 string module doesn't define ascii_letters 
     
    137140class EdPyKota(PyKotaTool) :         
    138141    """A class for edpykota.""" 
    139     def isValidPrinterName(self, printername) : 
    140         """Checks if a printername is valid.""" 
    141         # unfortunately Python 2.1 string modules doesn't define ascii_letters... 
    142         asciiletters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' 
    143         digits = '0123456789' 
    144         if printername[0] in asciiletters : 
    145             validchars = asciiletters + digits + "-_" 
    146             for c in printername[1:] : 
    147                 if c not in validchars : 
    148                     return 0 
    149             return 1         
    150         return 0 
    151          
    152142    def main(self, names, options) : 
    153143        """Edit user or group quotas.""" 
     
    156146            pname = options["printer"] 
    157147            if options["add"] and pname : 
    158                 if self.isValidPrinterName(pname) : 
     148                if self.isValidName(pname) : 
    159149                    self.storage.addPrinter(pname) 
     150                    printernames = [ pname ] 
    160151                else :     
    161152                    raise PyKotaToolError, "Invalid printer name %s" % pname