diff --git a/bin/showgroup.py b/bin/showgroup.py index b6daaaf0d27b96dc2f18f16d511e8c36ad55285d..55edd9bdebc8d083bbcc77e8c8813ae22a0a7370 100755 --- a/bin/showgroup.py +++ b/bin/showgroup.py @@ -42,7 +42,7 @@ def main(): sys.exit('No groups found.') if len(groups) != 1: - #groups.sort('cn') + groups.sort('cn') groups.remove_attrs([v for k, v in NOOPTS.items() if args[k]]) print(groups) diff --git a/lib/isg/dphysldap.py b/lib/isg/dphysldap.py index 72b26f8060f6ae08859bf16a5c35be181e02776a..171b160d8486b3332815cdcc5f13b965b58f9fc3 100644 --- a/lib/isg/dphysldap.py +++ b/lib/isg/dphysldap.py @@ -160,8 +160,19 @@ class Entries(list): table = [[e[a] for a in self.attrs] for e in self] return tabulate.tabulate(table, tablefmt=FMT, headers=self.attrs) - #def sort(self, attr): - # self = sorted(self, key=lambda k: k[attr].__str__()) + def sort(self, attr): + super().sort(key=lambda k: str(k[attr])) + + # def l(k): + # return str(k[attr]) + + # l = [] + # for i in self: + # criteria = l(i) + # l.append(criteria) + + # return sorted(l, ) + def remove_attr(self, attr): if attr in self.attrs: