Changeset 791 for pykota/trunk/pykota

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

Now repykota should output the recorded total page number for each printer too.

Location:
pykota/trunk/pykota
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storage.py

    r773 r791  
    1515# 
    1616# $Log$ 
     17# Revision 1.7  2003/02/10 12:07:31  jalet 
     18# Now repykota should output the recorded total page number for each printer too. 
     19# 
    1720# Revision 1.6  2003/02/09 13:05:43  jalet 
    1821# Internationalization continues... 
     
    4851    """Base class for all storages.""" 
    4952    def getMatchingPrinters(self, printerpattern) : 
    50         """Returns the list of all printer names which match a certain pattern.""" 
     53        """Returns the list of all printers tuples (name, pagecounter) which match a certain pattern for the printer name.""" 
    5154        pass 
    5255             
  • pykota/trunk/pykota/storages/sql.py

    r784 r791  
    1515# 
    1616# $Log$ 
     17# Revision 1.18  2003/02/10 12:07:31  jalet 
     18# Now repykota should output the recorded total page number for each printer too. 
     19# 
    1720# Revision 1.17  2003/02/10 08:41:36  jalet 
    1821# edpykota's --reset command line option resets the limit date too. 
     
    7780class SQLStorage :     
    7881    def getMatchingPrinters(self, printerpattern) : 
    79         """Returns the list of all printer names which match a certain pattern.""" 
     82        """Returns the list of all printers tuples (name, pagecounter) which match a certain pattern for the printer name.""" 
    8083        printerslist = [] 
    8184        # We 'could' do a SELECT printername FROM printers WHERE printername LIKE ... 
    8285        # but we don't because other storages semantics may be different, so every 
    8386        # storage should use fnmatch to match patterns and be storage agnostic 
    84         result = self.doQuery("SELECT printername FROM printers;") 
     87        result = self.doQuery("SELECT printername, pagecounter FROM printers;") 
    8588        result = self.doParseResult(result) 
    8689        if result is not None : 
    8790            for printer in result : 
    8891                if fnmatch.fnmatchcase(printer["printername"], printerpattern) : 
    89                     printerslist.append(printer["printername"]) 
     92                    printerslist.append((printer["printername"], printer["pagecounter"])) 
    9093        return printerslist         
    9194             
     
    9699    def getPrinterUsers(self, printername) :         
    97100        """Returns the list of usernames which uses a given printer.""" 
    98         result = self.doQuery("SELECT DISTINCT username FROM users WHERE id IN (SELECT userid FROM userpquota WHERE printerid IN (SELECT printerid FROM printers WHERE printername=%s));" % self.doQuote(printername)) 
     101        result = self.doQuery("SELECT DISTINCT username FROM users WHERE id IN (SELECT userid FROM userpquota WHERE printerid IN (SELECT printerid FROM printers WHERE printername=%s)) ORDER BY username;" % self.doQuote(printername)) 
    99102        result = self.doParseResult(result) 
    100103        if result is None :