Re: [Freeipa-devel] [PATCH] jderose 019 remove some cruft

2009-10-14 Thread Jason Gerard DeRose
On Wed, 2009-10-14 at 17:21 -0400, Rob Crittenden wrote:
> Jason Gerard DeRose wrote:
> > On Tue, 2009-10-13 at 22:45 -0600, Jason Gerard DeRose wrote:
> >> This removes the util.add_global_options() function and the
> >> frontend.Application class, neither of which are now needed.
> > 
> > And *this* actually attaches the patch.  ;)
> >
> 
> ack

pushed to master.

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH] jderose 019 remove some cruft

2009-10-14 Thread Rob Crittenden

Jason Gerard DeRose wrote:

On Tue, 2009-10-13 at 22:45 -0600, Jason Gerard DeRose wrote:

This removes the util.add_global_options() function and the
frontend.Application class, neither of which are now needed.


And *this* actually attaches the patch.  ;)



ack


smime.p7s
Description: S/MIME Cryptographic Signature
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Re: [Freeipa-devel] [PATCH] jderose 019 remove some cruft

2009-10-13 Thread Jason Gerard DeRose
On Tue, 2009-10-13 at 22:45 -0600, Jason Gerard DeRose wrote:
> This removes the util.add_global_options() function and the
> frontend.Application class, neither of which are now needed.

And *this* actually attaches the patch.  ;)
>From c88f87dc36aed3b5e13450c0c3361c3f3469c2a5 Mon Sep 17 00:00:00 2001
From: Jason Gerard DeRose 
Date: Tue, 13 Oct 2009 22:23:19 -0600
Subject: [PATCH] Removed util.add_global_options() and frontend.Application

---
 ipalib/__init__.py |8 +-
 ipalib/cli.py  |4 +-
 ipalib/frontend.py |   41 
 ipalib/util.py |   23 
 tests/test_ipalib/test_frontend.py |   37 
 5 files changed, 4 insertions(+), 109 deletions(-)

diff --git a/ipalib/__init__.py b/ipalib/__init__.py
index 3b177da..d263d98 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 e470001..85282a0 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 622c427..b13ffed 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 5ea13dc..76be9a6 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=