diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2009-10-13 11:28:00 -0600 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2009-10-13 11:28:00 -0600 |
commit | f58ff2921defef330d53e08e427a82ced7585c88 (patch) | |
tree | c69823174d27be31d4488a331b3fde176f8e2679 /ipawebui/controller.py | |
parent | 1d6e23136a0664a86b765c67a9308f0951652f74 (diff) | |
download | freeipa.git-f58ff2921defef330d53e08e427a82ced7585c88.tar.gz freeipa.git-f58ff2921defef330d53e08e427a82ced7585c88.tar.xz freeipa.git-f58ff2921defef330d53e08e427a82ced7585c88.zip |
Giant webui patch take 2
Diffstat (limited to 'ipawebui/controller.py')
-rw-r--r-- | ipawebui/controller.py | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/ipawebui/controller.py b/ipawebui/controller.py deleted file mode 100644 index a2a270cb..00000000 --- a/ipawebui/controller.py +++ /dev/null @@ -1,71 +0,0 @@ -# Authors: Jason Gerard DeRose <jderose@redhat.com> -# -# Copyright (C) 2008 Red Hat -# see file 'COPYING' for use and warranty information -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; version 2 only -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -""" -Controller classes. -""" - -import simplejson -from ipalib.plugable import ReadOnly, lock - - -class Controller(ReadOnly): - exposed = True - - def __init__(self, template=None): - self.template = template - lock(self) - - def output_xhtml(self, **kw): - return self.template.serialize( - output='xhtml-strict', - format='pretty', - **kw - ) - - def output_json(self, **kw): - return simplejson.dumps(kw, sort_keys=True, indent=4) - - def __call__(self, **kw): - json = bool(kw.pop('_format', None) == 'json') - result = self.run(**kw) - assert type(result) is dict - if json or self.template is None: - return self.output_json(**result) - return self.output_xhtml(**result) - - def run(self, **kw): - return {} - - -class Command(Controller): - def __init__(self, command, template=None): - self.command = command - super(Command, self).__init__(template) - - def run(self, **kw): - return dict(command=self.command) - - -class Index(Controller): - def __init__(self, api, template=None): - self.api = api - super(Index, self).__init__(template) - - def run(self): - return dict(api=self.api) |