Changeset 1179

Show
Ignore:
Timestamp:
11/12/03 14:06:38 (20 years ago)
Author:
jalet
Message:

Bug fix wrt no user/group name command line argument to edpykota

Location:
pykota/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/edpykota

    r1156 r1179  
    2424# 
    2525# $Log$ 
     26# Revision 1.61  2003/11/12 13:06:35  jalet 
     27# Bug fix wrt no user/group name command line argument to edpykota 
     28# 
    2629# Revision 1.60  2003/10/09 21:25:24  jalet 
    2730# Multiple printer names or wildcards can be passed on the command line 
     
    448451                raise PyKotaToolError, _("There's no printer matching %s") % pname 
    449452        if not names :     
    450             if options["add"] and not printeradded : 
    451                 raise PyKotaToolError, _("You have to pass user or group names on the command line") 
     453            if options["add"] : 
     454                if not printeradded : 
     455                    raise PyKotaToolError, _("You have to pass user or group names on the command line") 
     456                else :     
     457                    names = getattr(self.storage, "getAll%ssNames" % suffix)() 
    452458            else :     
    453459                names = [ "*" ] # all users 
  • pykota/trunk/NEWS

    r1178 r1179  
    2222PyKota NEWS : 
    2323 
     24    - 1.16alpha6 : 
     25     
     26        - Bug fixed : when edpykota was used to add a printer 
     27          with no user or group name, a bad user/group name "*" was 
     28          added to the database. 
     29           
    2430    - 1.16alpha5 : 
    2531     
  • pykota/trunk/pykota/storages/ldapstorage.py

    r1170 r1179  
    2222# 
    2323# $Log$ 
     24# Revision 1.35  2003/11/12 13:06:37  jalet 
     25# Bug fix wrt no user/group name command line argument to edpykota 
     26# 
    2427# Revision 1.34  2003/10/24 08:37:55  jalet 
    2528# More complete messages in case of LDAP failure. 
     
    244247            return dn 
    245248             
     249    def getAllUsersNames(self) :     
     250        """Extracts all user names.""" 
     251        usernames = [] 
     252        result = self.doSearch("objectClass=pykotaAccount", ["pykotaUserName"], base=self.info["userbase"]) 
     253        if result : 
     254            usernames = [record[1]["pykotaUserName"][0] for record in result] 
     255        return usernames 
     256         
     257    def getAllGroupsNames(self) :     
     258        """Extracts all group names.""" 
     259        groupnames = [] 
     260        result = self.doSearch("objectClass=pykotaGroup", ["pykotaGroupName"], base=self.info["groupbase"]) 
     261        if result : 
     262            groupnames = [record[1]["pykotaGroupName"][0] for record in result] 
     263        return groupnames 
     264         
    246265    def getUserFromBackend(self, username) :     
    247266        """Extracts user information given its name.""" 
  • pykota/trunk/pykota/storages/pgstorage.py

    r1156 r1179  
    2222# 
    2323# $Log$ 
     24# Revision 1.21  2003/11/12 13:06:38  jalet 
     25# Bug fix wrt no user/group name command line argument to edpykota 
     26# 
    2427# Revision 1.20  2003/10/09 21:25:26  jalet 
    2528# Multiple printer names or wildcards can be passed on the command line 
     
    178181            typ = "text" 
    179182        return pg._quote(field, typ) 
     183         
     184    def getAllUsersNames(self) :     
     185        """Extracts all user names.""" 
     186        usernames = [] 
     187        result = self.doSearch("SELECT username FROM users;") 
     188        if result : 
     189            usernames = [record["username"] for record in result] 
     190        return usernames 
     191         
     192    def getAllGroupsNames(self) :     
     193        """Extracts all group names.""" 
     194        groupnames = [] 
     195        result = self.doSearch("SELECT groupname FROM groups;") 
     196        if result : 
     197            groupnames = [record["groupname"] for record in result] 
     198        return groupnames 
    180199         
    181200    def getUserFromBackend(self, username) :     
  • pykota/trunk/pykota/version.py

    r1178 r1179  
    2222# 
    2323 
    24 __version__ = "1.16alpha5_unofficial" 
     24__version__ = "1.16alpha6_unofficial" 
    2525 
    2626__doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""