Remove FormPlugin now that we use Django forms

This commit is contained in:
Sunil Mohan Adapa 2014-05-11 21:27:13 +05:30
parent b50a99b1e4
commit 94d0989503
3 changed files with 0 additions and 72 deletions

View File

@ -51,15 +51,6 @@ metaclasses can be created to make new classes of plugins.
Any place that might be affected by arbitrary addition of modules
should have its own metaclass.
### FromPlugin
Each form displayed in the interface should inherit from FormPlugin.
This will allow the system to display multiple forms on the page in
the correct order. Forms will likely also want to inherit from
PagePlugin because after the user clicks submit, the plugin usually
displays a responsive message or an error (along with the form to fill
out again).
## Coding Practices for Modules
All the

View File

@ -167,7 +167,6 @@ def setup():
cfg.users = plugin_mount.UserStoreModule.get_plugins()[0]
cfg.page_plugins = plugin_mount.PagePlugin.get_plugins()
cfg.log("Loaded %d page plugins" % len(cfg.page_plugins))
cfg.forms = plugin_mount.FormPlugin.get_plugins()
# Add an extra server
server = _cpserver.Server()

View File

@ -97,68 +97,6 @@ class PagePlugin:
return parts
class FormPlugin():
"""
Mount point for plugins that provide forms at specific URLs.
Form plugin classes should also inherit from PagePlugin so they
can implement the page that handles the results of the form. The
name of the class will be appended to each url where the form is
displayed to get the urls of the results pages.
Plugins implementing this reference should provide the following attributes:
url - list of URL path strings of pages on which to display this
form, not including the url path that *only* displays this form
(that's handled by the index method)
order - How high up on the page should this content be displayed?
Lower order is higher up.
The following attributes are optional (though without at least one
of them, this plugin won't do much):
sidebar_right - text to be displayed in the right column (can be attribute or method) (optional)
sidebar_left - text to be displayed in the left column (can be attribute or method) (optional)
main - text to be displayed in the center column (i.e. the form) (can be attribute or method)
js - attribute containing a string that will be placed in the
template head, just below the javascript loads. Use it to load
more javascript files (optional)
Although this plugin is intended for forms, it could just display
some html and skip the form.
"""
__metaclass__ = PluginMount
order = 50
url = []
def __init__(self, *args, **kwargs):
for unit in self.url:
path = unit.split("/")[1:] + [self.__class__.__name__]
_setattr_deep(cfg.html_root, path, self)
cfg.log("Registered page: %s" % '.'.join(path))
def main(self, *args, **kwargs):
return "<p>Override this method and replace it with a form.</p>"
@cherrypy.expose
@require()
def index(self, **kwargs):
"""If the user has tried to fill in the form, process it, otherwise, just display a default form."""
if kwargs:
kwargs['message'] = self.process_form(**kwargs)
parts = get_parts(self, **kwargs)
return util.render_template(**parts)
def process_form(self, **kwargs):
"""Process the form. Return any message as a result of processing."""
pass
class UserStoreModule:
"""
Mount Point for plugins that will manage the user backend storage,