[Zope3-checkins] CVS: Zope3/src/zope/publisher/interfaces - __init__.py:1.2 browser.py:1.2 http.py:1.2 vfs.py:1.2 xmlrpc.py:1.2
Jim Fulton
jim@zope.com
Wed, 25 Dec 2002 09:15:49 -0500
Update of /cvs-repository/Zope3/src/zope/publisher/interfaces
In directory cvs.zope.org:/tmp/cvs-serv20790/src/zope/publisher/interfaces
Added Files:
__init__.py browser.py http.py vfs.py xmlrpc.py
Log Message:
Grand renaming:
- Renamed most files (especially python modules) to lower case.
- Moved views and interfaces into separate hierarchies within each
project, where each top-level directory under the zope package
is a separate project.
- Moved everything to src from lib/python.
lib/python will eventually go away. I need access to the cvs
repository to make this happen, however.
There are probably some bits that are broken. All tests pass
and zope runs, but I haven't tried everything. There are a number
of cleanups I'll work on tomorrow.
=== Zope3/src/zope/publisher/interfaces/__init__.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:15:49 2002
+++ Zope3/src/zope/publisher/interfaces/__init__.py Wed Dec 25 09:15:18 2002
@@ -0,0 +1,353 @@
+##############################################################################
+#
+# 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.0 (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.
+#
+##############################################################################
+"""Interfaces for the publisher.
+
+$Id$
+"""
+
+from zope.interface import Interface
+from zope.interface import Attribute
+from zope.exceptions import Unauthorized
+from zope.exceptions import NotFoundError
+from zope.component.interfaces import IPresentationRequest
+from zope.interface.common.mapping import IEnumerableMapping
+
+
+class PublishingException(Exception):
+ pass
+
+
+class TraversalException(PublishingException):
+ pass
+
+
+class NotFound(NotFoundError, TraversalException):
+
+ def __init__(self, ob, name, request=None):
+ self.ob = ob
+ self.name = name
+
+ def getObject(self):
+ return self.ob
+
+ def getName(self):
+ return self.name
+
+ def __str__(self):
+ try: ob = `self.ob`
+ except: ob = 'unprintable object'
+ return 'Object: %s, name: %s' % (ob, `self.name`)
+
+
+class DebugError(TraversalException):
+
+ def __init__(self, ob, message):
+ self.ob = ob
+ self.message = message
+
+ def getObject(self):
+ return self.ob
+
+ def getMessage(self):
+ return self.message
+
+ def __str__(self):
+ return self.message
+
+
+class BadRequest(PublishingException):
+
+ def __init__(self, message):
+ self.message = message
+
+ def __str__(self):
+ return self.message
+
+
+class Redirect(PublishingException):
+
+ def __init__(self, location):
+ self.location = location
+
+ def getLocation(self):
+ return self.location
+
+ def __str__(self):
+ return 'Location: %s' % self.location
+
+
+class Retry (PublishingException):
+ """Raise this to retry a request.
+ """
+
+ def __init__(self, orig_exc=None):
+ self.orig_exc = orig_exc
+
+ def getOriginalException(self):
+ return self.orig_exc
+
+ def __str__(self):
+ return repr(self.orig_exc)
+
+
+class IPublishTraverse(Interface):
+
+ def publishTraverse(request, name):
+ """Lookup a name
+
+ The request argument is the publisher request object.
+ """
+
+
+def IPublisher(Interface):
+
+ def publish(request):
+ """Publish a request
+
+ The request must be an IPublisherRequest.
+ """
+
+
+class IPublisherResponse(Interface):
+ """Interface used by the publsher
+ """
+
+ def setBody(result):
+ """Sets the response result value.
+ """
+
+ def handleException(exc_info):
+ """Handles an otherwise unhandled exception.
+
+ The publication object gets the first chance to handle an exception,
+ and if it doesn't have a good way to do it, it defers to the
+ response. Implementations should set the reponse body.
+ """
+
+ def internalError():
+ """Called when the exception handler bombs.
+
+ Should report back to the client that an internal error occurred.
+ """
+
+ def outputBody():
+ """Outputs the response to the client
+ """
+
+ def retry():
+ """Returns a retry response
+
+ Returns a response suitable for repeating the publication attempt.
+ """
+
+
+class IPublication(Interface):
+ """Object publication framework.
+
+ The responsibility of publication objects is to provide
+ application hooks for the publishing process. This allows
+ application-specific tasks, such as connecting to databases,
+ managing transactions, and setting security contexts to be invoked
+ during the publishing process.
+
+ """
+ # The order of the hooks mostly corresponds with the order in which
+ # they are invoked.
+
+ def beforeTraversal(request):
+ """Pre-traversal hook.
+
+ This is called *once* before any traversal has been done.
+ """
+
+ def getApplication(request):
+ """Returns the object where traversal should commence.
+ """
+
+ def callTraversalHooks(request, ob):
+ """Invokes any traversal hooks associated with the object.
+ """
+
+ def traverseName(request, ob, name, check_auth=1):
+ """Traverses to the next object.
+
+ If check_auth is set,
+ performs idenitification, authentication, and authorization.
+ Returns the subobject.
+ """
+
+ def afterTraversal(request, ob):
+ """Post-traversal hook.
+ """
+
+ def callObject(request, ob):
+ """Call the object, returning the result.
+
+ For GET/POST this means calling it, but for other methods
+ (including those of WebDAV and FTP) this might mean invoking
+ a method of an adapter.
+ """
+
+ def afterCall(request):
+ """Post-callObject hook (if it was successful).
+ """
+
+ def handleException(object, request, exc_info, retry_allowed=1):
+ """Handle an exception
+
+ Either:
+ - sets the body of the response, request.response, or
+ - raises a Retry exception, or
+ - throws another exception, which is a Bad Thing.
+
+ Note that this method should not leak, which means that
+ exc_info must be set to some other value before exiting the method.
+ """
+
+
+class IApplicationResponse(Interface):
+ """Features that support application logic
+ """
+
+ def write(string):
+ """Output a string to the response body.
+ """
+
+
+class IPublicationRequest(IPresentationRequest):
+ """Interface provided by requests to IPublication objects
+ """
+
+ user = Attribute("""User object associated with the request
+
+ It is up to the publication object to set this
+ attribute.
+ """)
+
+ response = Attribute("""the request's response object
+
+ Return an IPublisherResponse for the request.
+ """)
+
+ def close():
+ """Release resources held by the request.
+ """
+
+ def hold(object):
+ """Hold a reference to an object until the request is closed
+ """
+
+ def getTraversalStack():
+ """Return the request traversal stack
+
+ This is a sequence of steps to traverse in reverse order. They
+ will be traversed from last to first.
+ """
+
+ def setTraversalStack(stack):
+ """Change the traversal stack.
+
+ See getTraversalStack.
+ """
+
+ def getPositionalArguments():
+ """Return the positional arguments given to the request.
+ """
+
+ def setViewSkin(skin):
+ """Set the skin to be used for the request.
+
+ It's up to the publication object to decide this.
+ """
+
+
+class IPublisherRequest(IPublicationRequest):
+ """Request interface use by the publisher
+
+ The responsibility of requests is to encapsulate protocol
+ specific details, especially wrt request inputs.
+
+ Request objects also serve as "context" objectsm providing
+ construction of and access to responses and storage of publication
+ objects.
+
+ """
+
+ def supportsRetry():
+ """Check whether the request supports retry
+
+ Return a boolean value indicating whether the request can be retried.
+ """
+
+ def retry():
+ """Return a retry request
+
+ Return a request suitable for repeating the publication attempt.
+ """
+
+ publication = Attribute("""the request's publication object
+
+ The publication object, an IRequestPublication provides
+ application-specific functionality hooks.
+ """)
+
+ def setPublication(publication):
+ """Set the request's publication object
+ """
+
+ def traverse(object):
+ """Traverse from the given object to the published object
+
+ The published object is returned.
+
+ The following hook methods on the publication will be called:
+
+ - callTraversalHooks is called before each step and after
+ the last step.
+
+ - traverseName to actually do a single traversal
+
+ """
+
+ def processInputs():
+ """Do any input processing that needs to bve done before traversing
+
+ This is done after construction to allow the publisher to
+ handle errors that arise.
+ """
+
+
+class IApplicationRequest(IEnumerableMapping):
+ """Features that support application logic
+ """
+
+ user = Attribute("""User object associated with the request
+ This is a read-only attribute.
+ """)
+
+ body = Attribute("""the body of the request as a string""")
+
+ bodyFile = Attribute("""the body of the request as a file""")
+
+ def __getitem__(key):
+ """Return request data
+
+ The only request data are envirnment variables.
+ """
+
+ environment = Attribute(
+ """Request environment data
+
+ This is a read-only mapping from variable name to value.
+ """)
=== Zope3/src/zope/publisher/interfaces/browser.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:15:49 2002
+++ Zope3/src/zope/publisher/interfaces/browser.py Wed Dec 25 09:15:18 2002
@@ -0,0 +1,166 @@
+##############################################################################
+#
+# 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.0 (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.
+#
+##############################################################################
+"""
+
+Revision information:
+$Id$
+"""
+
+from zope.interface import Interface
+from zope.interface import Attribute
+
+from zope.component.interfaces import IPresentation
+from zope.component.interfaces import IResource
+from zope.component.interfaces import IView
+
+from zope.publisher.interfaces import IPublication
+from zope.publisher.interfaces import IPublishTraverse
+from zope.publisher.interfaces.http import IHTTPApplicationRequest
+from zope.publisher.interfaces.http import IHTTPRequest
+
+
+class IBrowserPresentation(IPresentation):
+ """Browser presentations are for interaction with user's using Web Browsers
+ """
+
+
+class IBrowserApplicationRequest(IHTTPApplicationRequest):
+ """Browser-specific requests
+ """
+
+ def __getitem__(key):
+ """Return Browser request data
+
+ Request data sre retrieved from one of:
+
+ - Environment variables
+
+ These variables include input headers, server data, and other
+ request-related data. The variable names are as <a
+ href="http://hoohoo.ncsa.uiuc.edu/cgi/env.html">specified</a>
+ in the <a
+ href="http://hoohoo.ncsa.uiuc.edu/cgi/interface.html">CGI
+ specification</a>
+
+ - Cookies
+
+ These are the cookie data, if present.
+
+ - Form data
+
+ Form data are searched before cookies, which are searched
+ before environmental data.
+ """
+
+ form = Attribute(
+ """Form data
+
+ This is a read-only mapping from name to form value for the name.
+ """)
+
+
+class IBrowserResource(IBrowserPresentation, IResource):
+ """Browser View
+ """
+
+ def __call__():
+ """Return a URL for getting the resource
+
+ This URL should not be context dependent. Typically, the URL
+ will be based on the service that defined the resource.
+ """
+
+
+class IBrowserPublication(IPublication):
+ """Object publication framework.
+ """
+
+ def getDefaultTraversal(request, ob):
+ """Get the default published object for the request
+
+ Allows a default view to be added to traversal.
+ Returns (ob, steps_reversed).
+ """
+
+
+class IVirtualHostRequest(Interface):
+ """The support for virtual hosts in Zope is very important.
+
+ In order to make virtual hosts working, we need to support several
+ methods in our Request object. This interface defines the required
+ methods.
+ """
+
+ def setVirtualRoot(path, hard=0):
+ """Treat the current publishing object as a VirtualRoot.
+ """
+
+
+ def convertPhysicalPathToVirtualPath(path):
+ """Remove the path to the VirtualRoot from a physical path.
+ """
+
+
+ def convertPhysicalPathToURL(path, relative=0):
+ """Convert a physical path into a URL in the current context.
+ """
+
+
+ def getPhysicalPathFromURL(URL):
+ """Convert a URL into a physical path in the current context.
+
+ If the URL makes no sense in light of the current virtual
+ hosting context, a ValueError is raised.
+ """
+
+ def getEffectiveURL(self):
+ """Return the effective URL.
+ """
+
+
+class IBrowserRequest(IHTTPRequest, IVirtualHostRequest):
+ """Browser-specific Request functionality.
+
+ Note that the browser is special in many ways, since it exposes
+ the Request object to the end-developer.
+ """
+
+
+class IBrowserPublisher(IPublishTraverse):
+
+ def browserDefault(request):
+ """Provide the default object
+
+ The default object is expressed as a (possibly different)
+ object and/or additional traversal steps.
+
+ Returns an object and a sequence of names. If the sequence of
+ names is not empty, then a traversal step is made for each name.
+ After the publisher gets to the end of the sequence, it will
+ call browserDefault on the last traversed object.
+
+ Normal usage is to return self for object and a default view name.
+
+ The publisher calls this method at the end of each traversal path. If
+ a non-empty sequence of names is returned, the publisher will traverse
+ those names and call browserDefault again at the end.
+
+ Note that if additional traversal steps are indicated (via a
+ nonempty sequence of names), then the publisher will try to adjust
+ the base href.
+ """
+
+
+class IBrowserView(IBrowserPresentation, IView):
+ "Browser View"
=== Zope3/src/zope/publisher/interfaces/http.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:15:49 2002
+++ Zope3/src/zope/publisher/interfaces/http.py Wed Dec 25 09:15:18 2002
@@ -0,0 +1,305 @@
+##############################################################################
+#
+# 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.0 (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.
+#
+##############################################################################
+"""HTTP-related publisher interfaces.
+
+$Id$
+"""
+
+from zope.interface import Interface
+from zope.interface import Attribute
+
+from zope.publisher.interfaces import IApplicationRequest
+from zope.publisher.interfaces import IApplicationResponse
+
+
+class IHTTPApplicationRequest(IApplicationRequest):
+ """HTTP request data.
+
+ This object provides access to request data. This includes, the
+ input headers, server data, and cookies.
+
+ Request objects are created by the object publisher and will be
+ passed to published objects through the argument name, REQUEST.
+
+ The request object is a mapping object that represents a
+ collection of variable to value mappings. In addition, variables
+ are divided into four categories:
+
+ - Environment variables
+
+ These variables include input headers, server data, and other
+ request-related data. The variable names are as <a
+ href="http://hoohoo.ncsa.uiuc.edu/cgi/env.html">specified</a>
+ in the <a
+ href="http://hoohoo.ncsa.uiuc.edu/cgi/interface.html">CGI
+ specification</a>
+
+ - Cookies
+
+ These are the cookie data, if present.
+
+ - Other
+
+ Data that may be set by an application object.
+
+ The request object may be used as a mapping object, in which case
+ values will be looked up in the order: environment variables,
+ other variables, cookies, and special.
+ """
+
+ def __getitem__(key):
+ """Return HTTP request data
+
+ Request data sre retrieved from one of:
+
+ - Environment variables
+
+ These variables include input headers, server data, and other
+ request-related data. The variable names are as <a
+ href="http://hoohoo.ncsa.uiuc.edu/cgi/env.html">specified</a>
+ in the <a
+ href="http://hoohoo.ncsa.uiuc.edu/cgi/interface.html">CGI
+ specification</a>
+
+ - Cookies
+
+ These are the cookie data, if present.
+
+ Cookies are searched before environmental data.
+ """
+
+ def getCookies():
+ """Return the cookie data
+
+ Data are returned as a mapping object, mapping cookie name to value.
+ """
+
+ return IMapping(str, str)
+
+ cookies = Attribute(
+ """Request cookie data
+
+ This is a read-only mapping from variable name to value.
+ """)
+
+ def getHeader(name, default=None):
+ """Get a header value
+
+ Return the named HTTP header, or an optional default
+ argument or None if the header is not found. Note that
+ both original and CGI-ified header names are recognized,
+ e.g. 'Content-Type', 'CONTENT_TYPE' and 'HTTP_CONTENT_TYPE'
+ should all return the Content-Type header, if available.
+ """
+
+ headers = Attribute(
+ """Request header data
+
+ This is a read-only mapping from variable name to value.
+ """)
+
+ URL = Attribute(
+ """Request URL data
+
+ When convered to a string, this gives the effective published URL.
+
+ This is object can also be used as a mapping object. The keys
+ must be integers or strings that can be converted to
+ integers. A non-negative integer returns a URL n steps from
+ the URL of the top-level application objects. A negative
+ integer gives a URL that is -n steps back from the effective
+ URL.
+
+ For example, 'request.URL[-2]' is equivalent to the Zope 2
+ 'request["URL2"]'. The notion is that this would be used in
+ path expressions, like 'request/URL/-2'.
+ """)
+
+
+ def getURL(level=0, path_only=0):
+ """Return the published URL with level names removed from the end.
+
+ If path_only is true, then only a path will be returned.
+ """
+
+ def getApplicationURL(depth=0, path_only=0):
+ """Return the application URL plus depth steps
+
+ If path_only is true, then only a path will be returned.
+ """
+
+
+class IHTTPPublisher(Interface):
+
+ def publishTraverse(request, name):
+ """Lookup a name
+
+ The request argument is the publisher request object.
+ """
+
+
+# XXX Should we extend IRequest?
+
+class IHTTPRequest(Interface):
+
+ def setPathSuffix(steps):
+ """Add additional traversal steps to be taken after all other traversal
+
+ This is used to handle HTTP request methods (except for GET
+ and POST in the case of browser requests) and XML-RPC methods.
+ """
+
+
+class IHTTPCredentials(Interface):
+
+ # XXX Eventially this will be a different method
+ def _authUserPW():
+ """Return (login, password) if there are basic credentials;
+ return None if there aren't."""
+
+ def unauthorized(challenge):
+ """Issue a 401 Unauthorized error (asking for login/password).
+ The challenge is the value of the WWW-Authenticate header."""
+
+
+class IHTTPApplicationResponse(IApplicationResponse):
+ """HTTP Response
+ """
+
+ def redirect(location, status=302):
+ """Causes a redirection without raising an error.
+ """
+
+
+class IHTTPResponse(Interface):
+ """An object representation of an HTTP response.
+
+ The Response type encapsulates all possible responses to HTTP
+ requests. Responses are normally created by the object publisher.
+ A published object may recieve the response object as an argument
+ named 'RESPONSE'. A published object may also create its own
+ response object. Normally, published objects use response objects
+ to:
+
+ - Provide specific control over output headers,
+
+ - Set cookies, or
+
+ - Provide stream-oriented output.
+
+ If stream oriented output is used, then the response object
+ passed into the object must be used.
+ """
+
+ def getStatus():
+ """Returns the current HTTP status code as an integer.
+ """
+
+
+ def setStatus(status, reason=None):
+ """Sets the HTTP status code of the response
+
+ The argument may either be an integer or a string from { OK,
+ Created, Accepted, NoContent, MovedPermanently,
+ MovedTemporarily, NotModified, BadRequest, Unauthorized,
+ Forbidden, NotFound, InternalError, NotImplemented,
+ BadGateway, ServiceUnavailable } that will be converted to the
+ correct integer value.
+ """
+
+
+ def setHeader(name, value, literal=0):
+ """Sets an HTTP return header "name" with value "value"
+
+ The previous value is cleared. If the literal flag is true,
+ the case of the header name is preserved, otherwise
+ word-capitalization will be performed on the header name on
+ output.
+ """
+
+
+ def addHeader(name, value):
+ """Add an HTTP Header
+
+ Sets a new HTTP return header with the given value, while retaining
+ any previously set headers with the same name.
+
+ """
+
+
+ def getHeader(name, default=None):
+ """Gets a header value
+
+ Returns the value associated with a HTTP return header, or
+ 'default' if no such header has been set in the response
+ yet.
+ """
+
+
+ def getHeaders():
+ """Returns a mapping of correctly-cased header names to values.
+ """
+
+
+ def appendToCookie(name, value):
+ """Append text to a cookie value
+
+ If a value for the cookie has previously been set, the new
+ value is appended to the old one separated by a colon.
+ """
+
+
+ def expireCookie(name, **kw):
+ """Causes an HTTP cookie to be removed from the browser
+
+ The response will include an HTTP header that will remove the cookie
+ corresponding to "name" on the client, if one exists. This is
+ accomplished by sending a new cookie with an expiration date
+ that has already passed. Note that some clients require a path
+ to be specified - this path must exactly match the path given
+ when creating the cookie. The path can be specified as a keyword
+ argument.
+ """
+
+
+ def setCookie(name, value, **kw):
+ """Sets an HTTP cookie on the browser
+
+ The response will include an HTTP header that sets a cookie on
+ cookie-enabled browsers with a key "name" and value
+ "value". This overwrites any previously set value for the
+ cookie in the Response object.
+ """
+
+ def appendToHeader(name, value, delimiter=","):
+ """Appends a value to a header
+
+ Sets an HTTP return header "name" with value "value",
+ appending it following a comma if there was a previous value
+ set for the header.
+
+ """
+
+ def setCharset(charset=None):
+ """Set the character set into which the response body should be
+ encoded. If None is passed in then no encoding will be done to
+ the output body.
+
+ The default character set is None.
+ """
+
+ def setCharsetUsingRequest(request):
+ """This convinience function determines the character set based on the
+ HTTP header information.
+ """
=== Zope3/src/zope/publisher/interfaces/vfs.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:15:49 2002
+++ Zope3/src/zope/publisher/interfaces/vfs.py Wed Dec 25 09:15:18 2002
@@ -0,0 +1,116 @@
+##############################################################################
+#
+# 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.0 (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.
+#
+##############################################################################
+"""Virtual File System interfaces for the publisher.
+
+$Id$
+"""
+
+from zope.interface import Interface
+
+from zope.component.interfaces import IPresentation
+from zope.component.interfaces import IView
+
+from zope.publisher.interfaces import IPublishTraverse
+
+
+class IVFSCredentials(Interface):
+
+ # XXX Eventually this will be a different method
+ def _authUserPW():
+ """Return (login, password) if there are basic credentials;
+ return None if there aren't."""
+
+ def unauthorized(challenge):
+ """Cause a FTP-based unautorized error message"""
+
+
+class IVFSPresentation(IPresentation):
+ """VFS presentations"""
+
+
+class IVFSView(IVFSPresentation, IView):
+ "VFS View"
+
+
+class IVFSPublisher(IPublishTraverse):
+ """VFS Publisher"""
+
+
+class IVFSObjectPublisher(IVFSPublisher):
+ """ """
+
+ def isdir():
+ """Returns true, if the object is a container, namely implements
+ IContainer. For all other cases it returns false.
+ """
+
+ def isfile():
+ """Returns always the oposite of isdir() for the same reasons.
+ """
+
+ def stat():
+ """This method should return the typical file stat information:
+ (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)
+ """
+
+
+class IVFSDirectoryPublisher(IVFSObjectPublisher):
+
+ def exists(name):
+ """Checks whether the name exists.
+ """
+
+ def listdir(with_stats=0, pattern='*'):
+ """Returns a sequence of names ot (name, stat)
+ """
+
+ def mkdir(name, mode=0777):
+ """Create a container with name in this object.
+ """
+
+ def remove(name):
+ """Remove file with naem from this container.
+ """
+
+ def rmdir(name):
+ """Remove the container name from this container.
+ """
+
+ def rename(old, new):
+ """Rename an object from old name to new name.
+ """
+
+ def writefile(name, mode, instream, start=0):
+ """Write a file to the container. If the object does not exist,
+ inspect the content and the file name to create the right object
+ type.
+ """
+
+ def check_writable(name):
+ """Check whether we can write to a subobject.
+ """
+
+
+class IVFSFilePublisher(IVFSObjectPublisher):
+ """This interface describes the necessary methods a VFS view has to
+ implement in order to be used by teh VFS.
+ """
+
+ def read(mode, outstream, start=0, end=-1):
+ """Read the content of this object.
+ """
+
+ def write(mode, instream, start=0):
+ """Write data specified in instream to object.
+ """
=== Zope3/src/zope/publisher/interfaces/xmlrpc.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:15:49 2002
+++ Zope3/src/zope/publisher/interfaces/xmlrpc.py Wed Dec 25 09:15:18 2002
@@ -0,0 +1,47 @@
+##############################################################################
+#
+# 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.0 (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.
+#
+##############################################################################
+"""Interfaces for the XMLRPC publisher.
+
+$Id$
+"""
+
+from zope.component.interfaces import IView
+
+from zope.component.interfaces import IPresentation
+from zope.publisher.interfaces import IPublication
+from zope.publisher.interfaces import IPublishTraverse
+
+
+class IXMLRPCPresentation(IPresentation):
+ """XMLRPC presentations are for interaction with user's
+ """
+
+
+class IXMLRPCPublisher(IPublishTraverse):
+ """XML-RPC Publisher"""
+
+
+class IXMLRPCPublication (IPublication):
+ """Object publication framework."""
+
+ def getDefaultTraversal(request, ob):
+ """Get the default published object for the request
+
+ Allows a default view to be added to traversal.
+ Returns (ob, steps_reversed).
+ """
+
+
+class IXMLRPCView(IXMLRPCPresentation, IView):
+ "XMLRPC View"