Changeset 763

Show
Ignore:
Timestamp:
05/14/06 19:08:18 (3 years ago)
Author:
stevegt
Message:

WikiWorkflowPatch:

add IRequestPostProcessor

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wikiworkflowpatch/0.9/wikiworkflowpatch.diff

    r754 r763  
    22=================================================================== 
    33--- trac/wiki/api.py    (.../vendor/trac-0.9.4) (revision 25) 
    4 +++ trac/wiki/api.py    (.../branches/wikiflowpatch/0.9)      (working copy) 
     4+++ trac/wiki/api.py    (.../branches/wikiflowpatch/0.9.4)    (working copy) 
    55@@ -65,16 +65,35 @@ 
    66   
     
    5555=================================================================== 
    5656--- trac/wiki/web_ui.py (.../vendor/trac-0.9.4) (revision 25) 
    57 +++ trac/wiki/web_ui.py (.../branches/wikiflowpatch/0.9)      (working copy) 
     57+++ trac/wiki/web_ui.py (.../branches/wikiflowpatch/0.9.4)    (working copy) 
    5858@@ -30,6 +30,7 @@ 
    5959 from trac.versioncontrol.diff import get_diff_options, hdf_diff 
     
    172172=================================================================== 
    173173--- trac/wiki/model.py  (.../vendor/trac-0.9.4) (revision 25) 
    174 +++ trac/wiki/model.py  (.../branches/wikiflowpatch/0.9)      (working copy) 
     174+++ trac/wiki/model.py  (.../branches/wikiflowpatch/0.9.4)    (working copy) 
    175175@@ -20,17 +20,17 @@ 
    176176 import time 
     
    299299+        return count 
    300300+ 
     301Index: trac/web/api.py 
     302=================================================================== 
     303--- trac/web/api.py     (.../vendor/trac-0.9.4) (revision 25) 
     304+++ trac/web/api.py     (.../branches/wikiflowpatch/0.9.4)      (working copy) 
     305@@ -240,7 +240,16 @@ 
     306         simply send the response itself and not return anything. 
     307         """ 
     308  
     309+class IRequestPostProcessor(Interface): 
     310+    """Extension point interface for request post-processors. 
     311+    Provides a clean way to override rendering behavior of existing 
     312+    components.""" 
     313  
     314+    def process(req, template, content_type): 
     315+        """Do any post-processing the request might need; typically 
     316+        adding values to req.hdf, or changing template or mime type. 
     317+        Always returns template and content type, even if unchanged.""" 
     318+ 
     319 def absolute_url(req, path=None): 
     320     """Reconstruct the absolute URL of the given request. 
     321      
     322Index: trac/web/main.py 
     323=================================================================== 
     324--- trac/web/main.py    (.../vendor/trac-0.9.4) (revision 25) 
     325+++ trac/web/main.py    (.../branches/wikiflowpatch/0.9.4)      (working copy) 
     326@@ -23,7 +23,7 @@ 
     327 from trac.perm import PermissionCache, PermissionError 
     328 from trac.util import escape, enum, format_datetime, http_date, to_utf8, Markup 
     329 from trac.web.api import absolute_url, Request, RequestDone, IAuthenticator, \ 
     330-                         IRequestHandler 
     331+                         IRequestHandler, IRequestPostProcessor 
     332 from trac.web.chrome import Chrome 
     333 from trac.web.clearsilver import HDFWrapper 
     334 from trac.web.href import Href 
     335@@ -60,6 +60,7 @@ 
     336  
     337     authenticators = ExtensionPoint(IAuthenticator) 
     338     handlers = ExtensionPoint(IRequestHandler) 
     339+    post_processors = ExtensionPoint(IRequestPostProcessor) 
     340  
     341     def authenticate(self, req): 
     342         for authenticator in self.authenticators: 
     343@@ -110,6 +111,10 @@ 
     344                 if not content_type: 
     345                     content_type = 'text/html' 
     346  
     347+                for processor in self.post_processors: 
     348+                    template, content_type = processor.process( 
     349+                            req, template, content_type) 
     350+ 
     351                 req.display(template, content_type or 'text/html') 
     352         finally: 
     353             # Give the session a chance to persist changes 
    301354Index: templates/wiki.cs 
    302355=================================================================== 
    303356--- templates/wiki.cs   (.../vendor/trac-0.9.4) (revision 25) 
    304 +++ templates/wiki.cs   (.../branches/wikiflowpatch/0.9)      (working copy) 
     357+++ templates/wiki.cs   (.../branches/wikiflowpatch/0.9.4)    (working copy) 
    305358@@ -289,6 +289,9 @@ 
    306359     if:trac.acl.WIKI_MODIFY ?>