-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prototype (and probably a little buggy) patch to make it easier to ru…
…n zope without a ZODB. This patch is really just to show the design decisions, a lot of work will follow if there is some consensus that these decisions are correct. The design decisions are: * Start moving ZODB specific stuff to a zope.app.zodb package. * The publication object gets a IRsourceFactory implementing object as it's first argument (idea stolen from zope.bobo). * The server startup scripts look for a utility implementing IApplicationFactory. The goal is to reduce the steps necessary to run zope without the ZODB to: * Implement and register an IApplicationFactory utility * Remove the <zodb> section from zope.conf
- Loading branch information
Brian Sutherland
committed
Apr 5, 2007
0 parents
commit f9358c9
Showing
6 changed files
with
1,626 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2001, 2002 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. | ||
# | ||
############################################################################## | ||
"""Publication Interfaces | ||
$Id$ | ||
""" | ||
__docformat__ = 'restructuredtext' | ||
|
||
from zope import interface | ||
import zope.component.interfaces | ||
|
||
class IPublicationRequestFactory(interface.Interface): | ||
"""Publication request factory""" | ||
|
||
def __call__(input_stream, output_steam, env): | ||
"""Create a request object to handle the given inputs | ||
A request is created and configured with a publication object. | ||
""" | ||
|
||
class IBeforeTraverseEvent(zope.component.interfaces.IObjectEvent): | ||
"""An event which gets sent on publication traverse""" | ||
|
||
request = interface.Attribute("The current request") | ||
|
||
class BeforeTraverseEvent(object): | ||
"""An event which gets sent on publication traverse""" | ||
|
||
interface.implements(IBeforeTraverseEvent) | ||
|
||
def __init__(self, ob, request): | ||
self.object = ob | ||
self.request = request | ||
|
||
|
||
class IEndRequestEvent(interface.Interface): | ||
"""An event which gets sent when the publication is ended""" | ||
|
||
|
||
class EndRequestEvent(object): | ||
"""An event which gets sent when the publication is ended""" | ||
|
||
interface.implements(IEndRequestEvent) | ||
|
||
def __init__(self, ob, request): | ||
self.object = ob | ||
self.request = request | ||
|
||
class IRequestFactory(interface.Interface): | ||
|
||
def __call__(input_stream, output_steam, env): | ||
"""Create a request object to handle input.""" | ||
|
||
class ISOAPRequestFactory(IRequestFactory): | ||
"""SOAP request factory""" | ||
|
||
class IHTTPRequestFactory(IRequestFactory): | ||
# TODO: should SOAP, XMLRPC, and Browser extend this? | ||
"""generic HTTP request factory""" | ||
|
||
class IXMLRPCRequestFactory(IRequestFactory): | ||
"""XMLRPC request factory""" | ||
|
||
class IBrowserRequestFactory(IRequestFactory): | ||
"""Browser request factory""" | ||
|
||
class IFileContent(interface.Interface): | ||
"""Marker interface for content that can be managed as files. | ||
The default view for file content has effective URLs that don't end in | ||
`/`. In particular, if the content included HTML, relative links in | ||
the HTML are relative to the container the content is in. | ||
""" | ||
|
||
|
||
class IRequestPublicationFactory(interface.Interface): | ||
""" request-publication factory """ | ||
|
||
def canHandle(environment): | ||
"""Return ``True`` if it can handle the request, otherwise ``False``. | ||
`environment` can be used by the factory to make a decision based on | ||
the HTTP headers. | ||
""" | ||
|
||
def __call__(): | ||
"""Return a tuple (request, publication)""" | ||
|
||
class IRequestPublicationRegistry(interface.Interface): | ||
"""A registry to lookup a RequestPublicationFactory by | ||
request method + mime-type. Multiple factories can be configured | ||
for the same method+mimetype. The factory itself can introspect | ||
the environment to decide if it can handle the request as given | ||
by the environment or not. Factories are sorted in the order | ||
of their registration in ZCML. | ||
""" | ||
|
||
def register(method, mimetype, name, priority, factory): | ||
"""Registers a factory for method+mimetype.""" | ||
|
||
def lookup(method, mimetype, environment): | ||
"""Lookup a factory for a given method+mimetype and a | ||
environment. | ||
""" | ||
|
||
def getFactoriesFor(method, mimetype): | ||
"""Return the internal datastructure representing the configured | ||
factories (basically for testing, not for introspection). | ||
""" | ||
|
||
class IResourceFactory(interface.Interface): | ||
|
||
def __call__(request): | ||
"""Return the root application object for the request.""" |
Oops, something went wrong.