Changeset 763 for pykota/trunk/bin
- Timestamp:
- 02/08/03 23:09:02 (22 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r762 r763 17 17 # 18 18 # $Log$ 19 # Revision 1.13 2003/02/08 22:09:02 jalet 20 # Only printer was added the first time. 21 # 19 22 # Revision 1.12 2003/02/08 21:44:49 jalet 20 23 # Python 2.1 string module doesn't define ascii_letters … … 137 140 class EdPyKota(PyKotaTool) : 138 141 """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 0149 return 1150 return 0151 152 142 def main(self, names, options) : 153 143 """Edit user or group quotas.""" … … 156 146 pname = options["printer"] 157 147 if options["add"] and pname : 158 if self.isValid PrinterName(pname) :148 if self.isValidName(pname) : 159 149 self.storage.addPrinter(pname) 150 printernames = [ pname ] 160 151 else : 161 152 raise PyKotaToolError, "Invalid printer name %s" % pname