[Zope3-checkins] SVN: Zope3/trunk/src/zope/ Fixed a few whitespace issues and developed a functional test that

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Apr 27 08:15:57 EDT 2006


Log message for revision 67637:
  Fixed a few whitespace issues and developed a functional test that 
  demonstrates the failure to delete a site. I commented out the failing 
  section, so that all tests in the trunk pass.
  
  

Changed:
  A   Zope3/trunk/src/zope/app/component/browser/ftests.py
  A   Zope3/trunk/src/zope/app/component/browser/site.txt
  U   Zope3/trunk/src/zope/app/component/site.txt
  U   Zope3/trunk/src/zope/component/registry.py

-=-
Added: Zope3/trunk/src/zope/app/component/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/component/browser/ftests.py	2006-04-27 11:31:54 UTC (rev 67636)
+++ Zope3/trunk/src/zope/app/component/browser/ftests.py	2006-04-27 12:15:56 UTC (rev 67637)
@@ -0,0 +1,34 @@
+##############################################################################
+#
+# Copyright (c) 2005 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Functional tests for the site management.
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+import unittest
+
+from zope.testing import doctest
+from zope.app.testing import functional
+
+def test_suite():
+    return unittest.TestSuite((
+        functional.FunctionalDocFileSuite(
+            "site.txt",
+            optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE),
+        ))
+
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: Zope3/trunk/src/zope/app/component/browser/ftests.py
___________________________________________________________________
Name: svn:keywords
   + Id

Added: Zope3/trunk/src/zope/app/component/browser/site.txt
===================================================================
--- Zope3/trunk/src/zope/app/component/browser/site.txt	2006-04-27 11:31:54 UTC (rev 67636)
+++ Zope3/trunk/src/zope/app/component/browser/site.txt	2006-04-27 12:15:56 UTC (rev 67637)
@@ -0,0 +1,44 @@
+Managing a Site
+---------------
+
+Create the browser object we'll be using.
+
+    >>> from zope.testbrowser.testing import Browser
+    >>> browser = Browser()
+    >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+    >>> browser.open('http://localhost/manage')
+
+When we originally enter a Zope instance, there is only a root folder that is
+already a site:
+
+    >>> 'Manage Site' in browser.contents
+    True
+
+Let's now add a new folder called ``samplesite`` and make it a site:
+
+    >>> browser.getLink(url='folder.Folder').click()
+    >>> browser.getControl(name='new_value').value = 'samplesite'
+    >>> browser.getControl('Apply').click()
+
+    >>> browser.getLink('samplesite').click()
+    >>> browser.getLink('Make a site').click()
+
+We are automatically forwarded to the site manager of the site. The default
+site management folder is always available:
+
+    >>> 'default' in browser.contents
+    True
+
+Let's now delete the site again:
+
+    >>> browser.getLink('[top]').click()
+    >>> browser.getControl(name='ids:list').getControl(
+    ...     value='samplesite').selected = True
+
+#    >>> browser.handleErrors = False
+#    >>> browser.getControl('Delete').click()
+#
+#The site should be gone now.
+#
+#    >>> 'samplesite' in self.contents
+#    False


Property changes on: Zope3/trunk/src/zope/app/component/browser/site.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: Zope3/trunk/src/zope/app/component/site.txt
===================================================================
--- Zope3/trunk/src/zope/app/component/site.txt	2006-04-27 11:31:54 UTC (rev 67636)
+++ Zope3/trunk/src/zope/app/component/site.txt	2006-04-27 12:15:56 UTC (rev 67637)
@@ -87,7 +87,7 @@
   >>> zope.component.interfaces.IComponentLookup(myfolder) is sm
   True
 
-During traversal, 
+During traversal,
 
   >>> from zope.app import publication
   >>> request = object()
@@ -161,7 +161,7 @@
   >>> from zope.app import zapi
   >>> gsm = zapi.getGlobalSiteManager()
   >>> gsm.registerUtility(gutil, IMyUtility, 'gutil')
-  
+
   >>> sm.queryUtility(IMyUtility, 'gutil')
   MyUtility('Global Utility')
 
@@ -195,7 +195,7 @@
   >>> size.context is file
   True
 
-By the way, once you set a site 
+By the way, once you set a site
 
   >>> hooks.setSite(myfolder)
 
@@ -224,7 +224,7 @@
 
 Until now we have only dealt with one local and the global site. But things
 really become interesting, once we have multiple sites. We can override other
-local configuration. 
+local configuration.
 
 Let's now create a new folder called `folder11`, add it to `myfolder` and make
 it a site:
@@ -286,7 +286,7 @@
   >>> gsm.registerHandler(
   ...    site.changeSiteConfigurationAfterMove,
   ...    (interfaces.ISite, container.interfaces.IObjectMovedEvent),
-  ...    ) 
+  ...    )
 
 We only have to register one event listener, since the copy action causes an
 `IObjectAddedEvent` to be created, which is just a special type of

Modified: Zope3/trunk/src/zope/component/registry.py
===================================================================
--- Zope3/trunk/src/zope/component/registry.py	2006-04-27 11:31:54 UTC (rev 67636)
+++ Zope3/trunk/src/zope/component/registry.py	2006-04-27 12:15:56 UTC (rev 67637)
@@ -36,7 +36,7 @@
         self.__bases__ = tuple(bases)
 
     def __repr__(self):
-        return "<%s %s>" % (self.__class__.__name__, self.__name__) 
+        return "<%s %s>" % (self.__class__.__name__, self.__name__)
 
     def _init_registries(self):
         self.adapters = zope.interface.adapter.AdapterRegistry()
@@ -51,7 +51,7 @@
     def _getBases(self):
         # Subclasses might override
         return self.__dict__.get('__bases__', ())
-        
+
     def _setBases(self, bases):
         # Subclasses might override
         self.adapters.__bases__ = tuple([
@@ -81,7 +81,7 @@
             if p == provided and c == component
             ]
 
-        self._utility_registrations[(provided, name)] = component, info        
+        self._utility_registrations[(provided, name)] = component, info
         self.utilities.register((), provided, name, component)
 
         if not subscribed:
@@ -120,7 +120,7 @@
         zope.event.notify(interfaces.Unregistered(
             UtilityRegistration(self, provided, name, component, old[1])
             ))
-        
+
         return True
 
     def registeredUtilities(self):
@@ -172,23 +172,23 @@
 
         if (required is None) and (factory is None):
             raise TypeError("Must specify one of factory and required")
-        
+
         required = _getAdapterRequired(factory, required)
         old = self._adapter_registrations.get((required, provided, name))
         if (old is None) or ((factory is not None) and
                              (factory != old[0])):
             return False
-        
+
         del self._adapter_registrations[(required, provided, name)]
         self.adapters.unregister(required, provided, name)
-        
+
         zope.event.notify(interfaces.Unregistered(
             AdapterRegistration(self, required, provided, name,
                                 *old)
             ))
 
         return True
-        
+
     def registeredAdapters(self):
         for ((required, provided, name), (component, info)
              ) in self._adapter_registrations.iteritems():
@@ -258,7 +258,7 @@
 
         if (required is None) and (factory is None):
             raise TypeError("Must specify one of factory and required")
-        
+
         required = _getAdapterRequired(factory, required)
 
         if factory is None:
@@ -276,11 +276,11 @@
 
         if len(new) == len(self._subscription_registrations):
             return False
-        
 
+
         self._subscription_registrations[:] = new
         self.adapters.unsubscribe(required, provided)
-        
+
         zope.event.notify(interfaces.Unregistered(
             SubscriptionRegistration(self, required, provided, name,
                                      factory, '')
@@ -302,7 +302,7 @@
             (required, name, factory, info)
             )
         self.adapters.subscribe(required, None, factory)
-        
+
         if event:
             zope.event.notify(interfaces.Registered(
                 HandlerRegistration(self, required, name, factory, info)
@@ -318,7 +318,7 @@
 
         if (required is None) and (factory is None):
             raise TypeError("Must specify one of factory and required")
-        
+
         required = _getAdapterRequired(factory, required)
 
         if factory is None:
@@ -336,7 +336,7 @@
 
         if len(new) == len(self._handler_registrations):
             return False
-        
+
         self._handler_registrations[:] = new
         self.adapters.unsubscribe(required, None)
 
@@ -394,8 +394,8 @@
                                 )
         result.append(r)
     return tuple(result)
-        
-        
+
+
 class UtilityRegistration(object):
 
     interface.implements(interfaces.IUtilityRegistration)
@@ -414,7 +414,7 @@
 
     def __cmp__(self, other):
         return cmp(self.__repr__(), other.__repr__())
-        
+
 class AdapterRegistration(object):
 
     interface.implements(interfaces.IAdapterRegistration)
@@ -428,7 +428,7 @@
         return '%s(%r, %s, %s, %r, %s, %r)' % (
             self.__class__.__name__,
             self.registry,
-            '[' + ", ".join([r.__name__ for r in self.required]) + ']', 
+            '[' + ", ".join([r.__name__ for r in self.required]) + ']',
             getattr(self.provided, '__name__', None), self.name,
             getattr(self.factory, '__name__', `self.factory`), self.info,
             )
@@ -465,7 +465,7 @@
         return '%s(%r, %s, %r, %s, %r)' % (
             self.__class__.__name__,
             self.registry,
-            '[' + ", ".join([r.__name__ for r in self.required]) + ']', 
+            '[' + ", ".join([r.__name__ for r in self.required]) + ']',
             self.name,
             getattr(self.factory, '__name__', `self.factory`), self.info,
             )
@@ -491,4 +491,4 @@
 def dispatchHandlerRegistrationEvent(registration, event):
     component.handle(registration.handler, event)
 
-    
+



More information about the Zope3-Checkins mailing list