summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorGiampaolo Lauria <lauria2@yahoo.com>2011-07-28 14:21:40 -0400
committerAndrew Bartlett <abartlet@samba.org>2011-09-09 15:24:00 +1000
commit0f580c0705a8d419af22300d0ece796ba1252095 (patch)
treeebc58b4e431af4d927187950635b2c65f02468dd /source4/scripting
parent4688b3ca60ebca000e489b489c6e67df848cfa98 (diff)
downloadsamba-0f580c0705a8d419af22300d0ece796ba1252095.tar.gz
samba-0f580c0705a8d419af22300d0ece796ba1252095.tar.bz2
samba-0f580c0705a8d419af22300d0ece796ba1252095.zip
samba-tool: Removed attribute name from Command class
Removed name as it is not used anywhere Moved all the attributes on top of the class declaration Signed-off-by: Amitay Isaacs <amitay@gmail.com> Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/netcmd/__init__.py33
1 files changed, 12 insertions, 21 deletions
diff --git a/source4/scripting/python/samba/netcmd/__init__.py b/source4/scripting/python/samba/netcmd/__init__.py
index f76fb8abbd..9636a3a05f 100644
--- a/source4/scripting/python/samba/netcmd/__init__.py
+++ b/source4/scripting/python/samba/netcmd/__init__.py
@@ -32,24 +32,27 @@ class Option(optparse.Option):
class Command(object):
"""A samba-tool command."""
-
+
def _get_description(self):
return self.__doc__.splitlines()[0].rstrip("\n")
- def _get_name(self):
- name = self.__class__.__name__
- if name.startswith("cmd_"):
- return name[4:]
- return name
+ description = property(_get_description)
- name = property(_get_name)
+ # synopsis must be defined in all subclasses in order to provide the command usage
+ synopsis = ""
+ takes_args = []
+ takes_options = []
+ takes_optiongroups = {
+ "sambaopts": options.SambaOptions,
+ "credopts": options.CredentialsOptions,
+ "versionopts": options.VersionOptions,
+ }
+ outf = sys.stdout
def usage(self, *args):
parser, _ = self._create_parser()
parser.print_usage()
- description = property(_get_description)
-
def show_command_error(self, e):
'''display a command error'''
if isinstance(e, CommandError):
@@ -84,18 +87,6 @@ class Command(object):
traceback.print_tb(etraceback)
sys.exit(1)
- outf = sys.stdout
-
- # synopsis must be defined in all subclasses in order to provide the command usage
- synopsis = ""
- takes_args = []
- takes_options = []
- takes_optiongroups = {
- "sambaopts": options.SambaOptions,
- "credopts": options.CredentialsOptions,
- "versionopts": options.VersionOptions,
- }
-
def _create_parser(self):
parser = optparse.OptionParser(self.synopsis)
parser.add_options(self.takes_options)