[Zope3-checkins] CVS: Zope3/src/zope/component - presentation.py:1.10

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Mar 23 17:08:30 EST 2004


Update of /cvs-repository/Zope3/src/zope/component
In directory cvs.zope.org:/tmp/cvs-serv22597/src/zope/component

Modified Files:
	presentation.py 
Log Message:


Rip out usage everywhere.




=== Zope3/src/zope/component/presentation.py 1.9 => 1.10 ===
--- Zope3/src/zope/component/presentation.py:1.9	Mon Mar 15 15:42:27 2004
+++ Zope3/src/zope/component/presentation.py	Tue Mar 23 17:07:58 2004
@@ -52,10 +52,6 @@
         """Define a layer
         """
     
-    def defineUsage(name):
-        """Define a usage
-        """
-
     def provideAdapter(request_type, factory, name='', contexts=(),
                        providing=zope.interface.Interface, layer='default'):
         """Provide a presentation adapter
@@ -227,7 +223,6 @@
         self._skins = {'default': [self._layers['default']]}
         self.skins = {'default': ('default', )}
         self.defaultSkin = 'default'
-        self._usages = {'default': GlobalUsage(self, 'default')}
 
     def defineSkin(self, name, layers):
         """Define a skin
@@ -279,13 +274,6 @@
     def queryLayer(self, name):
         return self._layers.get(name)
 
-    def queryUsage(self, name):
-        return self._usages.get(name)
-
-    def useUsage(self, name):
-        if name and not self.queryUsage(name):
-            raise ValueError, ('Undefined usage', name)
-    
     def setDefaultSkin(self, name):
         """Set the default skin for a request type
 
@@ -334,25 +322,6 @@
 
         self._layers[name] = GlobalLayer(self, name)
 
-    def defineUsage(self, name):
-        """
-        >>> s = GlobalPresentationService()
-        >>> s.defineUsage('custom')
-       
-        You cannot redefine a usage:
-        
-        >>> s.defineUsage('custom')
-        Traceback (most recent call last):
-        ...
-        ValueError: ("Can\'t redefine usage", 'custom')
-        """
-        if name in self._usages:
-            raise ValueError("Can\'t redefine usage", name)
-
-        self._usages[name] = GlobalUsage(self, name)
-
-
-    
     def provideAdapter(self, request_type, factory, name=u'', contexts=(), 
                        providing=zope.interface.Interface, layer='default'):
         """Provide a presentation adapter
@@ -504,10 +473,6 @@
 def GL(presentation_service, layer_name):
     return presentation_service.queryLayer(layer_name)
 
-def GU(presentation_service, usage_name):
-    return presentation_service.queryUsage(usage_name)
-
-
 class Layer(zope.interface.adapter.AdapterRegistry):
 
     def queryNamedAdapter(self, obj, interface, name, default=None):
@@ -533,16 +498,3 @@
     def __reduce__(self):
         return GL, (self.__parent__, self.__name__)
 
-    
-        
-
-
-class GlobalUsage(zope.interface.adapter.AdapterRegistry):
-
-    def __init__(self, parent, name):
-        zope.interface.adapter.AdapterRegistry.__init__(self)
-        self.__parent__ = parent
-        self.__name__ = name
-
-    def __reduce__(self):
-        return GU, (self.__parent__, self.__name__)




More information about the Zope3-Checkins mailing list