[Zope-Checkins] SVN: Products.Five/trunk/ sanely deal with deprecation warnings and remove a warning as well.

Philipp von Weitershausen philikon at philikon.de
Tue May 2 04:39:48 EDT 2006


Log message for revision 67816:
  sanely deal with deprecation warnings and remove a warning as well.
  

Changed:
  U   Products.Five/trunk/browser/tests/test_defaultview.py
  U   Products.Five/trunk/fiveconfigure.py
  U   Products.Five/trunk/fivedirectives.py
  U   Products.Five/trunk/viewlet/directives.txt

-=-
Modified: Products.Five/trunk/browser/tests/test_defaultview.py
===================================================================
--- Products.Five/trunk/browser/tests/test_defaultview.py	2006-05-02 08:22:56 UTC (rev 67815)
+++ Products.Five/trunk/browser/tests/test_defaultview.py	2006-05-02 08:39:48 UTC (rev 67816)
@@ -46,18 +46,21 @@
       >>> uf = self.folder.acl_users
       >>> uf._doAddUser('manager', 'r00t', ['Manager'], [])
 
-    BBB This is a test of backwards comaptibility with Five 1.3/Zope2.9.
-    The deprecated directive five:defaultViewable would before make
-    index.html the default view. Test that this is still the case.
-    five:defaultViewable goes away in Zope 2.12, and this test goes then too:
-      >>> import zope.deprecation
-      >>> zope.deprecation.__show__.off()
+    BBB This is a test of backwards comaptibility with Five 1.3/Zope
+    2.9.  The deprecated directive five:defaultViewable would before
+    make index.html the default view. Test that this is still the
+    case.  five:defaultViewable goes away in Zope 2.12, and this test
+    goes then too:
+
+      >>> import warnings
+      >>> showwarning = warnings.showwarning
+      >>> warnings.showwarning = lambda *a, **k: None
+
       >>> zcml.load_string('''
       ... <configure xmlns:five="http://namespaces.zope.org/five">
       ...   <five:defaultViewable
       ...     class="Products.Five.tests.testing.simplecontent.SimpleContent" />
       ... </configure>''')    
-      >>> zope.deprecation.__show__.on()
       >>> print http(r'''
       ... GET /test_folder_1_/testoid HTTP/1.1
       ... Authorization: Basic manager:r00t
@@ -66,9 +69,11 @@
       ...
       The eagle has landed
 
+      >>> warnings.showwarning = showwarning
 
-    But if we want to, we can specify another default view with 
+    But if we want to, we can specify another default view with
     browser:defaultView:
+
       >>> zcml.load_string('''
       ... <configure xmlns:browser="http://namespaces.zope.org/browser">
       ...   <browser:defaultView
@@ -93,7 +98,7 @@
       ...
       Default index_html called
 
-    Disabled __call__ overriding for now.  Causese more trouble than it
+    Disabled __call__ overriding for now.  Causes more trouble than it
     fixes.  Thus, no test here:
 
       #>>> print http(r'''

Modified: Products.Five/trunk/fiveconfigure.py
===================================================================
--- Products.Five/trunk/fiveconfigure.py	2006-05-02 08:22:56 UTC (rev 67815)
+++ Products.Five/trunk/fiveconfigure.py	2006-05-02 08:39:48 UTC (rev 67816)
@@ -111,21 +111,21 @@
 def isFiveMethod(m):
     return hasattr(m, '__five_method__')
 
+# BBB 2006/05/01 -- to be removed after 12 months
 def traversable(_context, class_):
-    warnings.warn("The five:traversable statement is no longer needed " \
-                  "and will be removed in Zope 2.12",
-                  DeprecationWarning)
-    
+    warnings.warn("The five:traversable statement is no longer needed "
+                  "and will be removed in Zope 2.12.",
+                  DeprecationWarning, 2)
+
+# BBB 2006/05/01 -- to be removed after 12 months
 def defaultViewable(_context, class_):
-    if zope.deprecation.__show__():
-        warnings.warn("The five:defaultViewable statement is no longer "     \
-                  "needed and will be removed in Zope 2.12. \n If you rely " \
-                  "on it to make 'index.html' the default view, replace it " \
+    warnings.warn("The five:defaultViewable statement is no longer "
+                  "needed and will be removed in Zope 2.12. \n If you rely "
+                  "on it to make 'index.html' the default view, replace it "
                   "with <browser:defaultView name='index.html' />",
                   DeprecationWarning, 2)
     implements(_context, class_, (IBrowserDefault,))
 
-
 def createZope2Bridge(zope2, package, name):
     # Map a Zope 2 interface into a Zope3 interface, seated within 'package'
     # as 'name'.

Modified: Products.Five/trunk/fivedirectives.py
===================================================================
--- Products.Five/trunk/fivedirectives.py	2006-05-02 08:22:56 UTC (rev 67815)
+++ Products.Five/trunk/fivedirectives.py	2006-05-02 08:39:48 UTC (rev 67816)
@@ -38,6 +38,7 @@
         value_type=GlobalObject()
         )
 
+# BBB 2006/05/01 -- to be removed after 12 months
 class ITraversableDirective(Interface):
     """Make instances of class traversable publically.
 
@@ -50,6 +51,7 @@
         required=True
         )
 
+# BBB 2006/05/01 -- to be removed after 12 months
 class IDefaultViewableDirective(Interface):
     """Make instances of class viewable publically.
 

Modified: Products.Five/trunk/viewlet/directives.txt
===================================================================
--- Products.Five/trunk/viewlet/directives.txt	2006-05-02 08:22:56 UTC (rev 67815)
+++ Products.Five/trunk/viewlet/directives.txt	2006-05-02 08:39:48 UTC (rev 67816)
@@ -393,12 +393,6 @@
 
   >>> from OFS.Folder import manage_addFolder
   >>> manage_addFolder(self.folder, 'ftf')
-  >>> context = zcml.load_string('''
-  ... <configure xmlns="http://namespaces.zope.org/five" i18n_domain="zope">
-  ...   <traversable class="OFS.Folder.Folder"
-  ...       />
-  ... </configure>
-  ... ''')
 
 Now we can register another simple viewlet manager:
 



More information about the Zope-Checkins mailing list