diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2009-10-13 22:23:19 -0600 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2009-10-14 15:07:17 -0600 |
commit | 5c9437b9e683a5f721595a5e312e4d61a11b60c7 (patch) | |
tree | 5ab4ec1fa7acd241c48c678a4f650fd3c9ff5f1f /ipalib | |
parent | f58ff2921defef330d53e08e427a82ced7585c88 (diff) | |
download | freeipa-5c9437b9e683a5f721595a5e312e4d61a11b60c7.tar.gz freeipa-5c9437b9e683a5f721595a5e312e4d61a11b60c7.tar.xz freeipa-5c9437b9e683a5f721595a5e312e4d61a11b60c7.zip |
Removed util.add_global_options() and frontend.Application
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/__init__.py | 8 | ||||
-rw-r--r-- | ipalib/cli.py | 4 | ||||
-rw-r--r-- | ipalib/frontend.py | 41 | ||||
-rw-r--r-- | ipalib/util.py | 23 |
4 files changed, 4 insertions, 72 deletions
diff --git a/ipalib/__init__.py b/ipalib/__init__.py index 3b177daa7..d263d98a5 100644 --- a/ipalib/__init__.py +++ b/ipalib/__init__.py @@ -866,7 +866,7 @@ freeIPA.org: import os import plugable from backend import Backend -from frontend import Command, LocalOrRemote, Application +from frontend import Command, LocalOrRemote from frontend import Object, Method, Property from crud import Create, Retrieve, Update, Delete, Search from parameters import DefaultFrom, Bool, Flag, Int, Float, Bytes, Str, Password,List @@ -900,13 +900,9 @@ def create_api(mode='dummy'): - `frontend.Property` - - `frontend.Application` - - `backend.Backend` """ - api = plugable.API( - Command, Object, Method, Property, Application, Backend - ) + api = plugable.API(Command, Object, Method, Property, Backend) if mode is not None: api.env.mode = mode assert mode != 'production' diff --git a/ipalib/cli.py b/ipalib/cli.py index e47000107..85282a039 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -612,7 +612,7 @@ class help(frontend.Command): print ' %s %s' % (to_cli(c.name).ljust(mcl), c.doc) -class console(frontend.Application): +class console(frontend.Command): """Start the IPA interactive Python console.""" def run(self): @@ -622,7 +622,7 @@ class console(frontend.Application): ) -class show_api(frontend.Application): +class show_api(frontend.Command): 'Show attributes on dynamic API object' takes_args = ('namespaces*',) diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 622c4276a..b13ffed42 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -1015,44 +1015,3 @@ class Property(Attribute): attr = getattr(self, name) if is_rule(attr): yield attr - - -class Application(Command): - """ - Base class for commands register by an external application. - - Special commands that only apply to a particular application built atop - `ipalib` should subclass from ``Application``. - - Because ``Application`` subclasses from `Command`, plugins that subclass - from ``Application`` with be available in both the ``api.Command`` and - ``api.Application`` namespaces. - """ - - __public__ = frozenset(( - 'application', - 'set_application' - )).union(Command.__public__) - __application = None - - def __get_application(self): - """ - Returns external ``application`` object. - """ - return self.__application - application = property(__get_application) - - def set_application(self, application): - """ - Sets the external application object to ``application``. - """ - if self.__application is not None: - raise AttributeError( - '%s.application can only be set once' % self.name - ) - if application is None: - raise TypeError( - '%s.application cannot be None' % self.name - ) - object.__setattr__(self, '_Application__application', application) - assert self.application is application diff --git a/ipalib/util.py b/ipalib/util.py index 5ea13dc8c..76be9a6d7 100644 --- a/ipalib/util.py +++ b/ipalib/util.py @@ -23,7 +23,6 @@ Various utility functions. import os import imp -import optparse import logging import time import krbV @@ -95,28 +94,6 @@ def import_plugins_subpackage(name): __import__(full_name) -def add_global_options(parser=None): - """ - Add global options to an optparse.OptionParser instance. - """ - if parser is None: - parser = optparse.OptionParser() - parser.disable_interspersed_args() - parser.add_option('-e', dest='env', metavar='KEY=VAL', action='append', - help='Set environment variable KEY to VAL', - ) - parser.add_option('-c', dest='conf', metavar='FILE', - help='Load configuration from FILE', - ) - parser.add_option('-d', '--debug', action='store_true', - help='Produce full debuging output', - ) - parser.add_option('-v', '--verbose', action='store_true', - help='Produce more verbose output', - ) - return parser - - class LogFormatter(logging.Formatter): """ Log formatter that uses UTC for all timestamps. |