[Zope3-checkins] SVN: Zope3/trunk/ Added another debug flag, ++debug++tal, that shows TAL markup in generated

Marius Gedminas marius at pov.lt
Sat Jun 12 06:42:47 EDT 2004


Log message for revision 25380:
Added another debug flag, ++debug++tal, that shows TAL markup in generated
pages.

Moved descriptions of new features into a new section in CHANGES.txt (they
were accidentally labeled as changes in beta 2).




-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2004-06-12 10:41:47 UTC (rev 25379)
+++ Zope3/trunk/doc/CHANGES.txt	2004-06-12 10:42:47 UTC (rev 25380)
@@ -6,19 +6,28 @@
 
   For information on future releases, see ROADMAP.txt.
 
-  Zope X3.0.0 Beta 2
+  Some future release
 
     New features
 
       - Added ++debug++ traversal adapter that allows you to turn on debugging
-        flags in request.debug.  Currently there is only one flag named
-        "source" that adds HTML comments to rendered page templates showing
-        where each code snippet came from.  Try
+        flags in request.debug.  Currently there are two debug flags:
 
-          http://localhost:8080/++debug++source/@@contents.html
+        + "source" adds HTML comments to rendered page templates showing
+           where each code snippet came from.
 
+        + "tal" leaves TAL/METAL markup in rendered page templates allowing
+          you to see how it was generated.
+
+        Try http://localhost:8080/++debug++source,tal/@@contents.html
         and view the source of the resulting page.
 
+    Restructuring
+
+      - Templated Pages are now called ZPT Pages.
+
+  Zope X3.0.0 Beta 2
+
     Bug fixes
 
       - Fixed bug in TypeRegistry for
@@ -39,10 +48,6 @@
 
       - ZopeVersion now know about Subversion.
 
-    Restructuring
-
-      - Templated Pages are now called ZPT Pages.
-
     Much thanks to everyone who contributed to this release:
 
       Jim Fulton, Marius Gedminas, Fred Drake, Philipp von Weitershausen,

Modified: Zope3/trunk/src/zope/app/pagetemplate/viewpagetemplatefile.py
===================================================================
--- Zope3/trunk/src/zope/app/pagetemplate/viewpagetemplatefile.py	2004-06-12 10:41:47 UTC (rev 25379)
+++ Zope3/trunk/src/zope/app/pagetemplate/viewpagetemplatefile.py	2004-06-12 10:42:47 UTC (rev 25380)
@@ -45,8 +45,9 @@
         namespace = self.pt_getContext(
             request=instance.request,
             instance=instance, args=args, options=keywords)
-        return self.pt_render(namespace,
-                    sourceAnnotations=instance.request.debug.sourceAnnotations)
+        debug_flags = instance.request.debug
+        return self.pt_render(namespace, showtal=debug_flags.showTAL,
+                              sourceAnnotations=debug_flags.sourceAnnotations)
 
     def __get__(self, instance, type=None):
         return BoundPageTemplate(self, instance)

Modified: Zope3/trunk/src/zope/app/traversing/namespace.py
===================================================================
--- Zope3/trunk/src/zope/app/traversing/namespace.py	2004-06-12 10:41:47 UTC (rev 25379)
+++ Zope3/trunk/src/zope/app/traversing/namespace.py	2004-06-12 10:42:47 UTC (rev 25380)
@@ -454,7 +454,7 @@
              True
              >>> request.debug.sourceAnnotations
              True
-             >>> adapter.traverse('source,source', ()) is ob
+             >>> adapter.traverse('source,tal', ()) is ob
              True
              >>> try:
              ...     adapter.traverse('badflag', ())
@@ -468,6 +468,8 @@
             for flag in name.split(','):
                 if flag == 'source':
                     request.debug.sourceAnnotations = True
+                elif flag == 'tal':
+                    request.debug.showTAL = True
                 else:
                     raise ValueError("Unknown debug flag: %s" % flag)
             return self.context

Modified: Zope3/trunk/src/zope/pagetemplate/pagetemplate.py
===================================================================
--- Zope3/trunk/src/zope/pagetemplate/pagetemplate.py	2004-06-12 10:41:47 UTC (rev 25379)
+++ Zope3/trunk/src/zope/pagetemplate/pagetemplate.py	2004-06-12 10:42:47 UTC (rev 25380)
@@ -51,7 +51,7 @@
         engine.  This method is free to use the keyword arguments it
         receives.
 
-    pt_render(namespace, source=False, sourceAnnotations=False)
+    pt_render(namespace, source=False, sourceAnnotations=False, showtal=False)
         Responsible the TAL interpreter to perform the rendering.  The
         namespace argument is a mapping which defines the top-level
         namespaces passed to the TALES expression engine.
@@ -99,7 +99,8 @@
     def pt_getEngine(self):
         return Engine
 
-    def pt_render(self, namespace, source=False, sourceAnnotations=False):
+    def pt_render(self, namespace, source=False, sourceAnnotations=False,
+                  showtal=False):
         """Render this Page Template"""
         self._cook_check()
         __traceback_supplement__ = (PageTemplateTracebackSupplement,
@@ -110,8 +111,8 @@
         output = StringIO(u'')
         context = self.pt_getEngineContext(namespace)
         TALInterpreter(self._v_program, self._v_macros,
-                       context, output, tal=not source, strictinsert=0,
-                       sourceAnnotations=sourceAnnotations)()
+                       context, output, tal=not source, showtal=showtal,
+                       strictinsert=0, sourceAnnotations=sourceAnnotations)()
         return output.getvalue()
 
     def pt_errors(self, namespace):

Modified: Zope3/trunk/src/zope/pagetemplate/readme.txt
===================================================================
--- Zope3/trunk/src/zope/pagetemplate/readme.txt	2004-06-12 10:41:47 UTC (rev 25379)
+++ Zope3/trunk/src/zope/pagetemplate/readme.txt	2004-06-12 10:42:47 UTC (rev 25380)
@@ -46,7 +46,7 @@
         engine.  This method is free to use the keyword arguments it
         receives.
 
-    pt_render(namespace, source=False, sourceAnnotations=False)
+    pt_render(namespace, source=False, sourceAnnotations=False, showtal=False)
         Responsible the TAL interpreter to perform the rendering.  The
         namespace argument is a mapping which defines the top-level
         namespaces passed to the TALES expression engine.

Modified: Zope3/trunk/src/zope/publisher/base.py
===================================================================
--- Zope3/trunk/src/zope/publisher/base.py	2004-06-12 10:41:47 UTC (rev 25379)
+++ Zope3/trunk/src/zope/publisher/base.py	2004-06-12 10:42:47 UTC (rev 25380)
@@ -159,6 +159,7 @@
     implements(IDebugFlags)
 
     sourceAnnotations = False
+    showTAL = False
 
 
 class BaseRequest(object):

Modified: Zope3/trunk/src/zope/publisher/interfaces/__init__.py
===================================================================
--- Zope3/trunk/src/zope/publisher/interfaces/__init__.py	2004-06-12 10:41:47 UTC (rev 25379)
+++ Zope3/trunk/src/zope/publisher/interfaces/__init__.py	2004-06-12 10:42:47 UTC (rev 25380)
@@ -390,6 +390,7 @@
     """Features that support debugging."""
 
     sourceAnnotations = Attribute("""Enable ZPT source annotations""")
+    showTAL = Attribute("""Leave TAL markup in rendered page templates""")
 
 
 class IApplicationRequest(IEnumerableMapping):




More information about the Zope3-Checkins mailing list