[Checkins] SVN: z3c.resourceinclude/trunk/ Use chameleon.zpt instead of z3c.pt (we don't need z3c.pt). Update template so it works again with last version of chamelon. Hope that change will stay compatible with further z3c.pt/chameleon releases ...

Sylvain Viollon sylvain at infrae.com
Wed Apr 8 11:25:32 EDT 2009


Log message for revision 99010:
  Use chameleon.zpt instead of z3c.pt (we don't need z3c.pt). Update template so it works again with last version of chamelon. Hope that change will stay compatible with further z3c.pt/chameleon releases ...
  
  

Changed:
  U   z3c.resourceinclude/trunk/setup.py
  U   z3c.resourceinclude/trunk/z3c/resourceinclude/configure.zcml
  U   z3c.resourceinclude/trunk/z3c/resourceinclude/provider.pt
  U   z3c.resourceinclude/trunk/z3c/resourceinclude/provider.py

-=-
Modified: z3c.resourceinclude/trunk/setup.py
===================================================================
--- z3c.resourceinclude/trunk/setup.py	2009-04-08 12:36:52 UTC (rev 99009)
+++ z3c.resourceinclude/trunk/setup.py	2009-04-08 15:25:32 UTC (rev 99010)
@@ -31,7 +31,7 @@
           'zope.app.cache',
           'zope.contentprovider',
           'plone.memoize',
-          'z3c.pt',
+          'chameleon.zpt',
           # -*- Extra requirements: -*-
       ],
       entry_points="""

Modified: z3c.resourceinclude/trunk/z3c/resourceinclude/configure.zcml
===================================================================
--- z3c.resourceinclude/trunk/z3c/resourceinclude/configure.zcml	2009-04-08 12:36:52 UTC (rev 99009)
+++ z3c.resourceinclude/trunk/z3c/resourceinclude/configure.zcml	2009-04-08 15:25:32 UTC (rev 99010)
@@ -1,8 +1,6 @@
 <configure xmlns="http://namespaces.zope.org/zope"
 	   xmlns:zcml="http://namespaces.zope.org/zcml">
 
-  <include package="z3c.pt" />
-  
   <adapter
      zcml:condition="have devmode"
      factory=".collector.ResourceCollector" />
@@ -10,5 +8,5 @@
   <adapter
      zcml:condition="not-have devmode"
      factory=".collector.DigestResourceCollector" />
-     
+
 </configure>

Modified: z3c.resourceinclude/trunk/z3c/resourceinclude/provider.pt
===================================================================
--- z3c.resourceinclude/trunk/z3c/resourceinclude/provider.pt	2009-04-08 12:36:52 UTC (rev 99009)
+++ z3c.resourceinclude/trunk/z3c/resourceinclude/provider.pt	2009-04-08 15:25:32 UTC (rev 99010)
@@ -1,23 +1,22 @@
 <div xmlns="http://www.w3.org/1999/xhtml"
      xmlns:tal="http://xml.zope.org/namespaces/tal"
-     tal:default-expression="path"
      tal:omit-tag="">
 
-  <tal:resource tal:repeat="resource options/resources">
+  <tal:resource tal:repeat="resource resources">
 
-    <script type="text/javascript" src="${resource/url}"
-	    tal:condition="python: resource.content_type == 'application/x-javascript'">
+    <script type="text/javascript" src="${resource.url}"
+	    tal:condition="resource.content_type == 'application/x-javascript'">
     </script>
 
     <style media="all" type="text/css"
-	   tal:condition="python:resource.content_type == 'text/css'">
-       ${python:options.comment('@import url("%s");' % resource.url)}
+	       tal:condition="resource.content_type == 'text/css'">
+      <!-- @import url("${resource.url}"); -->
     </style>
 
     <link type="text/kss"
 	  rel="kinetic-stylesheet"
-	  tal:condition="python:resource.content_type == 'text/kss'"
-	  tal:attributes="href resource/url" />
+	  tal:condition="resource.content_type == 'text/kss'"
+	  tal:attributes="href resource.url" />
 
   </tal:resource>
 

Modified: z3c.resourceinclude/trunk/z3c/resourceinclude/provider.py
===================================================================
--- z3c.resourceinclude/trunk/z3c/resourceinclude/provider.py	2009-04-08 12:36:52 UTC (rev 99009)
+++ z3c.resourceinclude/trunk/z3c/resourceinclude/provider.py	2009-04-08 15:25:32 UTC (rev 99010)
@@ -6,23 +6,28 @@
 from zope.contentprovider.interfaces import IContentProvider
 
 from z3c.resourceinclude.interfaces import IResourceCollector
-from z3c.pt.pagetemplate import ViewPageTemplateFile
+from chameleon.zpt.template import PageTemplateFile
 
-def html_comment(u):
-    return u'<!-- %s -->' % u
+import os.path
 
 import mimetypes
 if not '.kss' in mimetypes.types_map:
     mimetypes.add_type('text/kss', '.kss')
 
+
 def guess_mimetype(resource):
     return resource.context.content_type
 
+
+def local_file(filename):
+    return os.path.join(os.path.dirname(__file__), filename)
+
+
 class ResourceIncludeProvider(object):
     interface.implements(IContentProvider)
     component.adapts(interface.Interface, IBrowserRequest, IBrowserView)
 
-    template = ViewPageTemplateFile("provider.pt")
+    template = PageTemplateFile(local_file("provider.pt"))
 
     def __init__(self, context, request, view):
         self.context = context
@@ -37,4 +42,4 @@
                       'url': resource()} for \
                      resource in self.collector.collect()]
 
-        return self.template(resources=resources, comment=html_comment)
+        return self.template(resources=resources)



More information about the Checkins mailing list