[Zope-Checkins] CVS: Packages/ZPublisher - BaseRequest.py:1.56
Evan Simpson
evan at 4-am.com
Mon Mar 8 12:37:06 EST 2004
Update of /cvs-repository/Packages/ZPublisher
In directory cvs.zope.org:/tmp/cvs-serv6405/lib/python/ZPublisher
Modified Files:
BaseRequest.py
Log Message:
Minor tweak to post_traverse implementation and docstring.
=== Packages/ZPublisher/BaseRequest.py 1.55 => 1.56 ===
--- Packages/ZPublisher/BaseRequest.py:1.55 Wed Mar 3 06:07:01 2004
+++ Packages/ZPublisher/BaseRequest.py Mon Mar 8 12:37:05 2004
@@ -455,20 +455,30 @@
# Remove http request method from the URL.
request['URL']=URL
- # Run post traversal hooks here
- result = None
+ # Run post traversal hooks
if post_traverse:
result = exec_callables(post_traverse)
-
- if result is not None:
- object = result
+ if result is not None:
+ object = result
return object
def post_traverse(self, f, args=()):
- """Set a callable object and argument tuple to be combined if traversal succeeds."""
- if hasattr(self, "_post_traverse"):
- self._post_traverse.append((f, tuple(args)))
+ """Add a callable object and argument tuple to be post-traversed.
+
+ If traversal and authentication succeed, each post-traversal
+ pair is processed in the order in which they were added.
+ Each argument tuple is passed to its callable. If a callable
+ returns a value other than None, no more pairs are processed,
+ and the return value replaces the traversal result.
+ """
+ try:
+ pairs = self._post_traverse
+ except AttributeError:
+ raise RuntimeError, ('post_traverse() may only be called '
+ 'during publishing traversal.')
+ else:
+ pairs.append((f, tuple(args)))
retry_count=0
def supports_retry(self): return 0
More information about the Zope-Checkins
mailing list