[Checkins] SVN: grokcore.viewlet/trunk/src/grokcore/viewlet/ Delete few useless files, and tests.

Sylvain Viollon sylvain at infrae.com
Fri Oct 24 18:25:18 EDT 2008


Log message for revision 92532:
  Delete few useless files, and tests.
  
  

Changed:
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/ftests/catalog/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/ftests/form/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/ftests/rest/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/ftests/security/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/ftests/site/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/ftests/traversal/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/ftests/url/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/ftests/utility/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/ftests/xmlrpc/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/index.py
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/publication.py
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/rest.py
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/tests/catalog/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/tests/conflict/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/tests/container/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/tests/event/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/tests/json/
  D   grokcore.viewlet/trunk/src/grokcore/viewlet/tests/utility/

-=-
Deleted: grokcore.viewlet/trunk/src/grokcore/viewlet/index.py
===================================================================
--- grokcore.viewlet/trunk/src/grokcore/viewlet/index.py	2008-10-24 22:14:42 UTC (rev 92531)
+++ grokcore.viewlet/trunk/src/grokcore/viewlet/index.py	2008-10-24 22:25:17 UTC (rev 92532)
@@ -1,75 +0,0 @@
-#############################################################################
-#
-# Copyright (c) 2007-2008 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.
-#
-##############################################################################
-"""Grok index definitions
-"""
-import sys
-
-from zope.interface import implements
-from zope.interface.interfaces import IMethod, IInterface
-
-from zope.app.catalog.field import FieldIndex
-from zope.app.catalog.text import TextIndex
-from zc.catalog.catalogindex import SetIndex
-
-from martian.error import GrokError, GrokImportError
-from martian.util import frame_is_class
-
-from grok.interfaces import IIndexDefinition
-
-class IndexDefinition(object):
-    implements(IIndexDefinition)
-
-    index_class = None
-
-    def __init__(self, *args, **kw):
-        frame = sys._getframe(1)
-        if not frame_is_class(frame):
-            raise GrokImportError(
-                "%r can only be instantiated on class level." % self.__class__)
-        # store any extra parameters to pass to index later
-        self._args = args
-        self._attribute = kw.pop('attribute', None)
-        self._kw = kw
-
-    def setup(self, catalog, name, context, module_info):
-        if self._attribute is not None:
-            field_name = self._attribute
-        else:
-            field_name = name
-
-        if IInterface.providedBy(context):
-            try:
-                method = context[field_name]
-            except KeyError:
-                raise GrokError("grok.Indexes in %r refers to an attribute or "
-                                "method %r on interface %r, but this does not "
-                                "exist." % (module_info.getModule(),
-                                            field_name, context), None)
-            call = IMethod.providedBy(method)
-        else:
-            call = callable(getattr(context, field_name, None))
-            context = None # no interface lookup
-        catalog[name] = self.index_class(field_name=field_name,
-                                         interface=context,
-                                         field_callable=call,
-                                         *self._args, **self._kw)
-
-class Field(IndexDefinition):
-    index_class = FieldIndex
-
-class Text(IndexDefinition):
-    index_class = TextIndex
-
-class Set(IndexDefinition):
-    index_class = SetIndex

Deleted: grokcore.viewlet/trunk/src/grokcore/viewlet/publication.py
===================================================================
--- grokcore.viewlet/trunk/src/grokcore/viewlet/publication.py	2008-10-24 22:14:42 UTC (rev 92531)
+++ grokcore.viewlet/trunk/src/grokcore/viewlet/publication.py	2008-10-24 22:25:17 UTC (rev 92532)
@@ -1,90 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2007 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.
-#
-##############################################################################
-"""Grok publication objects
-"""
-
-from grok.rest import GrokMethodNotAllowed
-
-from zope import component
-from zope.security.proxy import removeSecurityProxy
-from zope.security.checker import selectChecker
-from zope.publisher.publish import mapply
-
-from zope.app.publication.http import BaseHTTPPublication, HTTPPublication
-from zope.app.publication.browser import BrowserPublication
-from zope.app.publication.requestpublicationfactories import \
-     BrowserFactory, XMLRPCFactory, HTTPFactory
-from zope.app.http.interfaces import IHTTPException
-
-class ZopePublicationSansProxy(object):
-
-    def getApplication(self, request):
-        result = super(ZopePublicationSansProxy, self).getApplication(request)
-        return removeSecurityProxy(result)
-
-    def traverseName(self, request, ob, name):
-        result = super(ZopePublicationSansProxy, self).traverseName(
-            request, ob, name)
-        return removeSecurityProxy(result)
-
-    def callObject(self, request, ob):
-        checker = selectChecker(ob)
-        if checker is not None:
-            checker.check(ob, '__call__')
-        return super(ZopePublicationSansProxy, self).callObject(request, ob)
-
-
-class GrokBrowserPublication(ZopePublicationSansProxy, BrowserPublication):
-
-    def getDefaultTraversal(self, request, ob):
-        obj, path = super(GrokBrowserPublication, self).getDefaultTraversal(
-            request, ob)
-        return removeSecurityProxy(obj), path
-
-
-class GrokBrowserFactory(BrowserFactory):
-
-    def __call__(self):
-        request, publication = super(GrokBrowserFactory, self).__call__()
-        return request, GrokBrowserPublication
-
-
-class GrokXMLRPCPublication(ZopePublicationSansProxy, BaseHTTPPublication):
-    pass
-
-class GrokXMLRPCFactory(XMLRPCFactory):
-
-    def __call__(self):
-        request, publication = super(GrokXMLRPCFactory, self).__call__()
-        return request, GrokXMLRPCPublication
-
-
-class GrokHTTPPublication(ZopePublicationSansProxy, HTTPPublication):
-   def callObject(self, request, ob):
-       orig = ob
-       if not IHTTPException.providedBy(ob):
-           ob = component.queryMultiAdapter((ob, request),
-                                            name=request.method)
-           checker = selectChecker(ob)
-           if checker is not None:
-               checker.check(ob, '__call__')
-           ob = getattr(ob, request.method, None)
-           if ob is None:
-               raise GrokMethodNotAllowed(orig, request)
-       return mapply(ob, request.getPositionalArguments(), request)
-
-class GrokHTTPFactory(HTTPFactory):
-    def __call__(self):
-        request, publication = super(GrokHTTPFactory, self).__call__()
-        return request, GrokHTTPPublication

Deleted: grokcore.viewlet/trunk/src/grokcore/viewlet/rest.py
===================================================================
--- grokcore.viewlet/trunk/src/grokcore/viewlet/rest.py	2008-10-24 22:14:42 UTC (rev 92531)
+++ grokcore.viewlet/trunk/src/grokcore/viewlet/rest.py	2008-10-24 22:25:17 UTC (rev 92532)
@@ -1,86 +0,0 @@
-import grok
-
-from zope import component
-from zope.component.interfaces import ComponentLookupError
-
-from zope.traversing.interfaces import TraversalError
-from zope.traversing.namespace import view
-from zope.interface import Interface
-from zope.interface.interfaces import IInterface
-from zope.publisher.interfaces.browser import IBrowserRequest
-from zope.publisher.interfaces.http import IHTTPRequest
-from zope.app.publication.http import MethodNotAllowed
-
-from grok.interfaces import IRESTSkinType
-from zope.publisher.browser import applySkin
-
-class GrokMethodNotAllowed(MethodNotAllowed):
-    pass
-
-class MethodNotAllowedView(grok.MultiAdapter):
-    grok.adapts(GrokMethodNotAllowed, IHTTPRequest)
-    grok.name('index.html')
-    grok.implements(Interface)
-    
-    def __init__(self, error, request):
-        self.error = error
-        self.request = request
-        self.allow = self._getAllow()
-        
-    def _getAllow(self):
-        allow = []
-        for method in ['GET', 'PUT', 'POST', 'DELETE']:
-            view = component.queryMultiAdapter(
-                (self.error.object, self.error.request),
-                name=method)
-            if view is not None:
-                is_not_allowed = getattr(view, 'is_not_allowed', False)
-                if not is_not_allowed:
-                    allow.append(method)
-        allow.sort()
-        return allow
-    
-    def __call__(self):
-        self.request.response.setHeader('Allow', ', '.join(self.allow))
-        self.request.response.setStatus(405)
-        return 'Method Not Allowed'
-
-class rest_skin(view):
-    """A rest skin.
-    
-    This used to be supported by zope.traversing but the change was backed out.
-    We need it for our REST support.
-    """
-    def traverse(self, name, ignored):
-        self.request.shiftNameToApplication()
-        try:
-            skin = component.getUtility(IRESTSkinType, name)
-        except ComponentLookupError:
-            raise TraversalError("++rest++%s" % name)
-        applySkin(self.request, skin)
-        return self.context
-
-
-class NotAllowedREST(grok.REST):
-    """These are registered for everything by default to cause the correct
-    errors.
-
-    Any more specific REST view overrides this.
-    """
-    grok.layer(grok.IRESTLayer)
-    grok.context(Interface)
-
-    is_not_allowed = True
-    
-    def GET(self):
-        raise GrokMethodNotAllowed(self.context, self.request)
-            
-    def POST(self):
-        raise GrokMethodNotAllowed(self.context, self.request)
-            
-    def PUT(self):
-        raise GrokMethodNotAllowed(self.context, self.request)
-    
-    def DELETE(self):
-        raise GrokMethodNotAllowed(self.context, self.request)
-            



More information about the Checkins mailing list