samba-tool: max() with key option is available in python >= 2.6
authorAmitay Isaacs <amitay@gmail.com>
Fri, 9 Sep 2011 03:24:10 +0000 (13:24 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 9 Sep 2011 05:24:04 +0000 (15:24 +1000)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
source4/scripting/python/samba/netcmd/__init__.py

index d4f9b4b7102a0f39fe15e646dbe84a0ac05f18d5..288993f561d59f1b3917db4943c3f0381a2395f4 100644 (file)
@@ -162,7 +162,7 @@ class SuperCommand(Command):
         print "Available subcommands:"
         subcmds = self.subcommands.keys()
         subcmds.sort()
-        max_length = len(max(subcmds, key=len))
+        max_length = max(map(lambda c: len(c), subcmds))
         for cmd in subcmds:
             print "  %*s  - %s" % (-max_length, cmd, self.subcommands[cmd].description)
         print " *  server connection needed"