diff mbox

[Branch,~linaro-validation/lava-dashboard-tool/trunk] Rev 149: Drop local copy of ExperimentalCommandMixIn

Message ID 20110623112713.12434.23124.launchpad@loganberry.canonical.com
State Accepted
Headers show

Commit Message

Zygmunt Krynicki June 23, 2011, 11:27 a.m. UTC
------------------------------------------------------------
revno: 149
committer: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
branch nick: trunk
timestamp: Thu 2011-06-23 13:24:34 +0200
message:
  Drop local copy of ExperimentalCommandMixIn
modified:
  lava_dashboard_tool/commands.py


--
lp:lava-dashboard-tool
https://code.launchpad.net/~linaro-validation/lava-dashboard-tool/trunk

You are subscribed to branch lp:lava-dashboard-tool.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dashboard-tool/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_dashboard_tool/commands.py'
--- lava_dashboard_tool/commands.py	2011-06-23 11:23:24 +0000
+++ lava_dashboard_tool/commands.py	2011-06-23 11:24:34 +0000
@@ -34,6 +34,7 @@ 
 import xmlrpclib
 
 from lava_tool.interface import Command
+from lava_tool.commands import ExperimentalCommandMixIn
 
 
 class InsufficientServerVersion(Exception):
@@ -425,62 +426,6 @@ 
         raise NotImplementedError()
 
 
-class ExperimentalNoticeAction(argparse.Action):
-    """
-    Argparse action that implements the --experimental-notice
-    """
-
-    message = """
-    Some lc-tool sub-commands are marked as EXPERIMENTAL. Those commands are
-    not guaranteed to work identically, or have identical interface between
-    subsequent lc-tool releases.
-
-    We do that to make it possible to provide good user interface and
-    server-side API when working on new features. Once a feature is stabilized
-    the UI will be frozen and all subsequent changes will retain backwards
-    compatibility.
-    """
-    message = message.lstrip()
-    message = re.sub(re.compile("[ \t]+", re.M), " ", message)
-    message = re.sub(re.compile("^ ", re.M), "", message)
-
-    def __init__(self,
-                 option_strings, dest, default=None, required=False,
-                 help=None):
-        super(ExperimentalNoticeAction, self).__init__(
-            option_strings=option_strings, dest=dest, default=default, nargs=0,
-            help=help)
-
-    def __call__(self, parser, namespace, values, option_string=None):
-        parser.exit(message=self.message)
-
-
-class ExperimentalCommandMixIn(object):
-    """
-    Experimental command.
-
-    Prints a warning message on each call to invoke()
-    """
-
-    def invoke(self):
-        self.print_experimental_notice()
-        return super(ExperimentalCommandMixIn, self).invoke()
-
-    @classmethod
-    def register_arguments(cls, parser):
-        retval = super(ExperimentalCommandMixIn, cls).register_arguments(parser)
-        parser.register("action", "experimental_notice", ExperimentalNoticeAction)
-        group = parser.add_argument_group("experimental commands")
-        group.add_argument("--experimental-notice",
-                            action="experimental_notice",
-                            default=argparse.SUPPRESS,
-                            help="Explain the nature of experimental commands")
-        return retval
-    
-    def print_experimental_notice(self):
-        print "EXPERIMENTAL - SUBJECT TO CHANGE (See --experimental-notice for more info)"
-
-
 class server_version(XMLRPCCommand):
     """
     Display dashboard server version