Changeset 748

Show
Ignore:
Timestamp:
02/07/03 23:13:13 (21 years ago)
Author:
jalet
Message:

Perhaps edpykota is now able to add printers !!! Oh, stupid me !

Location:
pykota/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/edpykota

    r720 r748  
    1717# 
    1818# $Log$ 
     19# Revision 1.6  2003/02/07 22:13:13  jalet 
     20# Perhaps edpykota is now able to add printers !!! Oh, stupid me ! 
     21# 
    1922# Revision 1.5  2003/02/06 14:49:04  jalet 
    2023# edpykota should be ok now 
     
    120123        printernames = self.storage.getMatchingPrinters(options["printer"]) 
    121124        if not printernames : 
    122             raise PyKotaToolError, "There's no printer matching %s" % options["printer"] 
     125            if options["add"] and options["printer"] and options["printer"].isalpha() : 
     126                self.storage.addPrinter(options["printer"]) 
     127            else : 
     128                raise PyKotaToolError, "There's no printer matching %s" % options["printer"] 
    123129        softlimit = hardlimit = None     
    124130        if options["softlimit"] : 
  • pykota/trunk/pykota/storages/sql.py

    r732 r748  
    1515# 
    1616# $Log$ 
     17# Revision 1.14  2003/02/07 22:13:13  jalet 
     18# Perhaps edpykota is now able to add printers !!! Oh, stupid me ! 
     19# 
    1720# Revision 1.13  2003/02/07 00:08:52  jalet 
    1821# Typos 
     
    7881        return printerslist         
    7982             
     83    def addPrinter(self, printername) :         
     84        """Adds a printer to the quota storage.""" 
     85        self.doQuery("INSERT INTO printers (printername) VALUES (%s);" % self.doQuote(printername)) 
     86         
    8087    def getPrinterUsers(self, printername) :         
    8188        """Returns the list of usernames which uses a given printer.""" 
     
    127134        (userid, printerid) = self.getUPIds(username, printername) 
    128135        if printerid is None :     
    129             self.doQuery("INSERT INTO printers (printername) VALUES (%s);" % self.doQuote(printername)) 
     136            self.addPrinter(printername)        # should we still add it ? 
    130137        if userid is None :     
    131138            self.doQuery("INSERT INTO users (username) VALUES (%s);" % self.doQuote(username))