[Repoze-dev] Repoze CVS: intro.txt uppercase.ini
Tres Seaver
tseaver at agendaless.com
Wed Sep 12 20:20:27 UTC 2007
Update of /home/repoze/cvs/repoze.obob/doc
In directory laguna.palladion.com:/tmp/cvs-serv16762/doc
Modified Files:
intro.txt uppercase.ini
Log Message:
- Break multiple plugpoints out into a separate helper class, configured
through new 'helper_factory' plugpoing on ObobPublisher.
- Remove use of 'request' anywhere (the helper is responsible for all that).
- Move old default plugpoint implementations out into DefaultHelper class.
Index: uppercase.ini
===================================================================
RCS file: /home/repoze/cvs/repoze.obob/doc/uppercase.ini,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- uppercase.ini 12 Sep 2007 18:23:35 -0000 1.1
+++ uppercase.ini 12 Sep 2007 20:20:25 -0000 1.2
@@ -12,7 +12,7 @@
repoze.obob.uppercase = string:ascii_letters.upper
[pipeline:main]
-pipeline = errorcatcher egg:Paste#httpexceptions obob
+pipeline = egg:Paste#evalerror egg:Paste#httpexceptions obob
[server:main]
use = egg:Paste#http
Index: intro.txt
===================================================================
RCS file: /home/repoze/cvs/repoze.obob/doc/intro.txt,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- intro.txt 12 Sep 2007 18:23:35 -0000 1.4
+++ intro.txt 12 Sep 2007 20:20:25 -0000 1.5
@@ -58,21 +58,41 @@
If needed, create / check out database connections, etc., based on
request, as well as initializing any per-request policy settings.
- 'request_factory' -- optional; called at the beginning of processing.
+ 'helper_factory' -- optional; called at the beginning of processing.
Contract::
- request_factory(wsgi_environ) -> request
+ helper_factory(wsgi_environ) -> helper
- The result will be passed as 'request' to the remaining configuration
- points.
+ The helper will then be used to implement the pluggable policies
+ for graph traversal.
- E.g., in the Zope2 stack, return a ZPublisher.HTTPRequest.HTTPRequest.
+ The default implementation returns an instance of
+ 'repoze.obob.publisher.DefaultHelper'.
- The default implementation just returns 'environ'.
- 'before_traverse' -- optional; if defined, called before traversing each
- edge.
+Supplying a different publication helper
+
+ The default helper (repoze.obob.publisher.DefaultHelper) provides
+ "sensible defaults" for the various traversal policies needed by obob.
+ Applications which need different policies can either override the
+ class, or supply a factory returning an object (e.g., a module) implementing
+ the same methods:
+
+ 'path_elements' -- required; computes the list of path elements to be
+ traversed
+
+ Contract::
+
+ path_elements() -> [elements]
+
+ E.g., in the Zope2`stack, break the 'PATH_INFO' environment value
+ into elements.
+
+ The default implementaition splits that key on '/', and returns all
+ non-empty elements.
+
+ 'before_traverse' -- required; called before traversing each edge.
Contract::
@@ -81,9 +101,7 @@
E.g. in the Zope2 stack, note location of most-recently-seen
'__allow_groups__' user folder.
- The callable may mutate request.
-
- 'traverse' -- optional; called to traverse each path element.
+ 'traverse' -- required; called to traverse each path element.
Contract::
@@ -94,7 +112,7 @@
The default implementaition calls '__getitem__' on 'current'.
- 'before_invoke' -- optional; called, if defined, just before invoking
+ 'before_invoke' -- required; called, if defined, just before invoking
the published object.
Contract::
@@ -104,7 +122,7 @@
E.g., in the Zope2 stack, ask the security machinery to authorize
access to the published object.
- 'invoke' -- optional; called to get the result from the published object.
+ 'invoke' -- required; called to get the result from the published object.
Contract::
@@ -114,7 +132,7 @@
The default implementaition just calls 'published', passing the request.
- 'map_result' -- optional; called to map the result onto triple for WSGI.
+ 'map_result' -- required; called to map the result onto triple for WSGI.
Contract::
@@ -127,6 +145,8 @@
status is 200, headers is an empty dict, body_iter is a list
containing the result.
+Sample obob configurations
+
The absolute minium configuration would thus be::
[app:hello_world]
@@ -138,9 +158,4 @@
[app:obob]
paste.app_factory = repoze.obob:make_obob
repopze.obob.get_root = repoze.zope2#get_application
- repopze.obob.before_traverse = repoze.zope2#before_publishing_traverse
- repopze.obob.traverse = repoze.zope2#publishing_traverse
- repopze.obob.before_invoke = repoze.zope2#before_invoke
- repopze.obob.invoke = repoze.zope2#do_mapply
- repopze.obob.map_result = repoze.zope2#map_result
-
+ repopze.obob.helper_factory = repoze.zope2#get_helper
_______________________________________________
Repoze-dev mailing list
Repoze-dev at lists.repoze.org
http://lists.repoze.org/mailman/listinfo/repoze-dev
More information about the Repoze-dev
mailing list