summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 36575f0)
raw | patch | inline | side by side (parent: 36575f0)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 16 Sep 2002 05:32:09 +0000 (05:32 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 16 Sep 2002 05:32:09 +0000 (05:32 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1175 57a73879-2fb5-44c3-a270-3262357dd7e2
doc/customizing.txt | patch | blob | history | |
roundup/cgi/client.py | patch | blob | history | |
roundup/cgi/templating.py | patch | blob | history |
diff --git a/doc/customizing.txt b/doc/customizing.txt
index 05958a8b0b178c7014d83032d91cb0bc7304ec27..7e05252f2d94776c17a02eda1f54ef029fee69e5 100644 (file)
--- a/doc/customizing.txt
+++ b/doc/customizing.txt
Customising Roundup
===================
-:Version: $Revision: 1.39 $
+:Version: $Revision: 1.40 $
.. This document borrows from the ZopeBook section on ZPT. The original is at:
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -1872,6 +1872,25 @@ So now, if the edit attempts to set the assignedto to a user that doesn't have
the "Fixer" Permission, the error will be raised.
+Setting up a "wizard" (or "druid") for controlled adding of issues
+------------------------------------------------------------------
+
+1. set up the page templates you wish to use for data input
+2. determine what actions need to be taken between the pages - these are
+ usually to validate user choices and determine what page is next
+3. encode those actions in methods on the interfaces Client class and insert
+ hooks to those actions in the "actions" attribute on that class, like so::
+
+ actions = client.Class.actions + (
+ ('page1_submit', page1SubmitAction),
+ ...
+ )
+
+ def page1SubmitAction(self):
+ # do the page 1 submit stuff, redirecting the user to the appropriate
+ # next page if necessary
+
+
-------------------
Back to `Table of Contents`_
diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py
index 9bb6ab524f7eb3ca200b4c575ec6c7499b40851f..8c8313ddd93024f535b3b3b59d890d929fc87d2a 100644 (file)
--- a/roundup/cgi/client.py
+++ b/roundup/cgi/client.py
-# $Id: client.py,v 1.33 2002-09-15 22:41:15 richard Exp $
+# $Id: client.py,v 1.34 2002-09-16 05:32:09 richard Exp $
__doc__ = """
WWW request handler (also used in the stand-alone server).
# let the template render figure stuff out
return pt.render(self, None, None, **kwargs)
except PageTemplate.PTRuntimeError, message:
- return '<strong>%s</strong><ol>%s</ol>'%(message,
- '<li>'.join(pt._v_errors))
+ return '<strong>%s</strong><ol><li>%s</ol>'%(message,
+ '<li>'.join([cgi.escape(x) for x in pt._v_errors]))
except NoTemplate, message:
return '<strong>%s</strong>'%message
except:
return self.renderTemplate(self.classname, self.template)
# these are the actions that are available
- actions = {
- 'edit': 'editItemAction',
- 'editCSV': 'editCSVAction',
- 'new': 'newItemAction',
- 'register': 'registerAction',
- 'login': 'loginAction',
- 'logout': 'logout_action',
- 'search': 'searchAction',
- }
+ actions = (
+ ('edit', 'editItemAction'),
+ ('editCSV', 'editCSVAction'),
+ ('new', 'newItemAction'),
+ ('register', 'registerAction'),
+ ('login', 'loginAction'),
+ ('logout', 'logout_action'),
+ ('search', 'searchAction'),
+ )
def handle_action(self):
''' Determine whether there should be an _action called.
The action is defined by the form variable :action which
identifies the method on this object to call. The four basic
- actions are defined in the "actions" dictionary on this class:
+ actions are defined in the "actions" sequence on this class:
"edit" -> self.editItemAction
"new" -> self.newItemAction
"register" -> self.registerAction
try:
# get the action, validate it
action = self.form[':action'].value
- if not self.actions.has_key(action):
+ for name, method in selc.actions:
+ if name == action:
+ break
+ else:
raise ValueError, 'No such action "%s"'%action
# call the mapped action
- getattr(self, self.actions[action])()
+ getattr(self, method)()
except Redirect:
raise
except Unauthorised:
index baa60c378388b65b9b6c08535f687d2f80d93ed8..a42ae90d2ff1d26c9f98221a07546ae63c3f3407 100644 (file)
if self._v_errors:
raise PageTemplate.PTRuntimeError, \
- 'Page Template %s has errors.' % self.id
+ 'Page Template %s has errors.'%self.id
# figure the context
classname = classname or client.classname