summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2009-10-13 22:23:19 -0600
committerJason Gerard DeRose <jderose@redhat.com>2009-10-14 15:07:17 -0600
commit5c9437b9e683a5f721595a5e312e4d61a11b60c7 (patch)
tree5ab4ec1fa7acd241c48c678a4f650fd3c9ff5f1f
parentf58ff2921defef330d53e08e427a82ced7585c88 (diff)
downloadfreeipa-5c9437b9e683a5f721595a5e312e4d61a11b60c7.tar.gz
freeipa-5c9437b9e683a5f721595a5e312e4d61a11b60c7.tar.xz
freeipa-5c9437b9e683a5f721595a5e312e4d61a11b60c7.zip
Removed util.add_global_options() and frontend.Application
-rw-r--r--ipalib/__init__.py8
-rw-r--r--ipalib/cli.py4
-rw-r--r--ipalib/frontend.py41
-rw-r--r--ipalib/util.py23
-rw-r--r--tests/test_ipalib/test_frontend.py37
5 files changed, 4 insertions, 109 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.
diff --git a/tests/test_ipalib/test_frontend.py b/tests/test_ipalib/test_frontend.py
index 53843cee8..71d902403 100644
--- a/tests/test_ipalib/test_frontend.py
+++ b/tests/test_ipalib/test_frontend.py
@@ -893,40 +893,3 @@ class test_Property(ClassChecker):
assert isinstance(param, parameters.Str)
assert param.name == 'givenname'
assert param.doc == 'User first name'
-
-
-class test_Application(ClassChecker):
- """
- Test the `ipalib.frontend.Application` class.
- """
- _cls = frontend.Application
-
- def test_class(self):
- """
- Test the `ipalib.frontend.Application` class.
- """
- assert self.cls.__bases__ == (frontend.Command,)
- assert type(self.cls.application) is property
-
- def test_application(self):
- """
- Test the `ipalib.frontend.Application.application` property.
- """
- assert 'application' in self.cls.__public__ # Public
- assert 'set_application' in self.cls.__public__ # Public
- app = 'The external application'
- class example(self.cls):
- 'A subclass'
- for o in (self.cls(), example()):
- assert read_only(o, 'application') is None
- e = raises(TypeError, o.set_application, None)
- assert str(e) == (
- '%s.application cannot be None' % o.__class__.__name__
- )
- o.set_application(app)
- assert read_only(o, 'application') is app
- e = raises(AttributeError, o.set_application, app)
- assert str(e) == (
- '%s.application can only be set once' % o.__class__.__name__
- )
- assert read_only(o, 'application') is app