Changeset 729 for pykota/trunk/pykota
- Timestamp:
- 02/07/03 00:20:03 (21 years ago)
- Location:
- pykota/trunk/pykota
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/sql.py
r723 r729 15 15 # 16 16 # $Log$ 17 # Revision 1.12 2003/02/06 23:20:03 jalet 18 # warnpykota doesn't need any user/group name argument, mimicing the 19 # warnquota disk quota tool. 20 # 17 21 # Revision 1.11 2003/02/06 15:05:13 jalet 18 22 # self was forgotten … … 71 75 return printerslist 72 76 77 def getPrinterUsers(self, printername) : 78 """Returns the list of usernames which uses a given printer.""" 79 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)) 80 result = result.doParseResult(result) 81 if result is None : 82 return [] 83 else : 84 return [record["username"] for record in result] 85 86 def getPrinterGroups(self, printername) : 87 """Returns the list of groups which uses a given printer.""" 88 result = self.doQuery("SELECT DISTINCT groupname FROM groups WHERE id IN (SELECT groupid FROM grouppquota WHERE printerid IN (SELECT printerid FROM printers WHERE printername=%s));" % self.doQuote(printername)) 89 result = result.doParseResult(result) 90 if result is None : 91 return [] 92 else : 93 return [record["groupname"] for record in result] 94 73 95 def getUserId(self, username) : 74 96 """Returns a userid given a username.""" -
pykota/trunk/pykota/tool.py
r728 r729 15 15 # 16 16 # $Log$ 17 # Revision 1.12 2003/02/06 23:20:02 jalet 18 # warnpykota doesn't need any user/group name argument, mimicing the 19 # warnquota disk quota tool. 20 # 17 21 # Revision 1.11 2003/02/06 22:54:33 jalet 18 22 # warnpykota should be ok … … 94 98 sys.exit(0) 95 99 96 def parseCommandline(self, argv, short, long ) :100 def parseCommandline(self, argv, short, long, allownothing=0) : 97 101 """Parses the command line, controlling options.""" 98 102 # split options in two lists: those which need an argument, those which don't need any … … 146 150 # should never occur 147 151 raise PyKotaToolError, "Unexpected problem when parsing command line" 148 elif (not args) and sys.stdin.isatty() : # no option and no argument, we display help if we are a tty152 elif (not args) and (not allownothing) and sys.stdin.isatty() : # no option and no argument, we display help if we are a tty 149 153 self.display_usage_and_quit() 150 154 except getopt.error, msg :