[Checkins] SVN: grok/trunk/ IApplication and getApplication moved to grokcore.site.

Sylvain Viollon sylvain at infrae.com
Thu Nov 4 09:52:17 EDT 2010


Log message for revision 118205:
  IApplication and getApplication moved to grokcore.site.
  

Changed:
  U   grok/trunk/CHANGES.txt
  U   grok/trunk/src/grok/__init__.py
  U   grok/trunk/src/grok/interfaces.py
  U   grok/trunk/src/grok/util.py

-=-
Modified: grok/trunk/CHANGES.txt
===================================================================
--- grok/trunk/CHANGES.txt	2010-11-04 13:50:37 UTC (rev 118204)
+++ grok/trunk/CHANGES.txt	2010-11-04 13:52:16 UTC (rev 118205)
@@ -4,7 +4,8 @@
 1.4 (unreleased)
 ================
 
-- Nothing changed yet.
+- The `IApplication` interface, and getApplication moved to
+  ``grokcore.site``.
 
 
 1.3 (2010-11-03)

Modified: grok/trunk/src/grok/__init__.py
===================================================================
--- grok/trunk/src/grok/__init__.py	2010-11-04 13:50:37 UTC (rev 118204)
+++ grok/trunk/src/grok/__init__.py	2010-11-04 13:52:16 UTC (rev 118205)
@@ -59,7 +59,6 @@
 
 from zope.event import notify
 from zope.site.hooks import getSite
-from grok.util import getApplication
 from zope.lifecycleevent import (
     IObjectCreatedEvent, ObjectCreatedEvent,
     IObjectModifiedEvent, ObjectModifiedEvent,

Modified: grok/trunk/src/grok/interfaces.py
===================================================================
--- grok/trunk/src/grok/interfaces.py	2010-11-04 13:50:37 UTC (rev 118204)
+++ grok/trunk/src/grok/interfaces.py	2010-11-04 13:52:16 UTC (rev 118205)
@@ -147,9 +147,6 @@
     def getSite():
         """Get the current site."""
 
-    def getApplication():
-        """Return the nearest enclosing `grok.Application`."""
-
     IRESTSkinType = interface.Attribute('The REST skin type')
 
 
@@ -180,14 +177,6 @@
         """The text of the request body.""")
 
 
-class IApplication(interface.Interface):
-    """Marker-interface for grok application factories.
-
-    Used to register applications as utilities to look them up and
-    provide a list of grokked applications.
-    """
-
-
 class IIndexDefinition(interface.Interface):
     """Define an index for grok.Indexes.
     """

Modified: grok/trunk/src/grok/util.py
===================================================================
--- grok/trunk/src/grok/util.py	2010-11-04 13:50:37 UTC (rev 118204)
+++ grok/trunk/src/grok/util.py	2010-11-04 13:52:16 UTC (rev 118205)
@@ -20,6 +20,7 @@
 from zope import interface
 from zope.schema.interfaces import WrongType
 from grokcore.view.util import url
+from grokcore.site.util import getApplication
 
 
 def safely_locate_maybe(obj, parent, name):
@@ -46,24 +47,6 @@
     interface.directlyProvides(request, *ifaces)
 
 
-def getApplication():
-    """Return the nearest enclosing `grok.Application`.
-
-    Raises ValueError if no Application can be found.
-    """
-    site = grok.getSite()
-    if grok.interfaces.IApplication.providedBy(site):
-        return site
-    # Another sub-site is within the application. Walk up the object
-    # tree until we get to the an application.
-    obj = site
-    while obj is not None:
-        if isinstance(obj, grok.Application):
-            return obj
-        obj = obj.__parent__
-    raise ValueError("No application found.")
-
-
 def application_url(request, obj, name=None, data={}):
     """Return the URL of the nearest enclosing `grok.Application`.
 



More information about the checkins mailing list