[Checkins] SVN: Sandbox/nadako/zope.browserresource/src/zope/browserresource/ Add deprecation hints for directives.

Dan Korostelev nadako at gmail.com
Mon Aug 24 06:41:05 EDT 2009


Log message for revision 103134:
  Add deprecation hints for directives.
  Extract the resource URL generation code (<baseurl>/@@/<resourcename>) into a separate method in AbsoluteURL adapter to make it overridable for cases when the Resources view are not registered as unnamed page.

Changed:
  U   Sandbox/nadako/zope.browserresource/src/zope/browserresource/metadirectives.py
  U   Sandbox/nadako/zope.browserresource/src/zope/browserresource/resource.py

-=-
Modified: Sandbox/nadako/zope.browserresource/src/zope/browserresource/metadirectives.py
===================================================================
--- Sandbox/nadako/zope.browserresource/src/zope/browserresource/metadirectives.py	2009-08-24 10:32:38 UTC (rev 103133)
+++ Sandbox/nadako/zope.browserresource/src/zope/browserresource/metadirectives.py	2009-08-24 10:41:05 UTC (rev 103134)
@@ -85,7 +85,11 @@
         title=u"Image",
         description=u"""
         If the image attribute is used, then an image resource, rather
-        than a file resource will be created.""",
+        than a file resource will be created.
+        
+        This attribute is deprecated in favor of pluggable resource types,
+        registered per extension. Use the "file" attribute instead.
+        """,
         required=False
         )
 
@@ -93,7 +97,13 @@
         title=u"Template",
         description=u"""
         If the template attribute is used, then a page template resource,
-        rather than a file resource will be created.""",
+        rather than a file resource will be created.
+
+        This attribute is deprecated in favor of pluggable resource types,
+        registered per extension. Use the "file" attribute instead. To
+        use page template resources, you need to instal zope.ptresource
+        package.
+        """,
         required=False
         )
 
@@ -141,7 +151,11 @@
         title=u"Image",
         description=u"""
         If the image attribute is used, then an image resource, rather
-        than a file resource will be created.""",
+        than a file resource will be created.
+
+        This attribute is deprecated, as images are now simply files.
+        Use the "file" attribute instead.
+        """,
         required=False
         )
 

Modified: Sandbox/nadako/zope.browserresource/src/zope/browserresource/resource.py
===================================================================
--- Sandbox/nadako/zope.browserresource/src/zope/browserresource/resource.py	2009-08-24 10:32:38 UTC (rev 103133)
+++ Sandbox/nadako/zope.browserresource/src/zope/browserresource/resource.py	2009-08-24 10:41:05 UTC (rev 103134)
@@ -46,6 +46,9 @@
         self.context = context
         self.request = request
 
+    def _createUrl(self, baseUrl, name):
+        return "%s/@@/%s" % (baseUrl, name)
+
     def __str__(self):
         name = self.context.__name__
         if name.startswith('++resource++'):
@@ -59,4 +62,4 @@
         else:
             url = str(base)
 
-        return "%s/@@/%s" % (url, name)
+        return self._createUrl(url, name)



More information about the Checkins mailing list