[Zope3-checkins] CVS: Zope3/src/zope/app/publisher - __init__.py:1.1.2.1 configure.zcml:1.1.2.1 fileresource.py:1.1.2.1 http.zcml:1.1.2.1 meta.zcml:1.1.2.1

Jim Fulton jim@zope.com
Mon, 23 Dec 2002 14:32:03 -0500


Update of /cvs-repository/Zope3/src/zope/app/publisher
In directory cvs.zope.org:/tmp/cvs-serv19908/zope/app/publisher

Added Files:
      Tag: NameGeddon-branch
	__init__.py configure.zcml fileresource.py http.zcml meta.zcml 
Log Message:
Initial renaming before debugging

=== Added File Zope3/src/zope/app/publisher/__init__.py ===
#
# This file is necessary to make this directory a package.


=== Added File Zope3/src/zope/app/publisher/configure.zcml ===
<zopeConfigure xmlns='http://namespaces.zope.org/zope' >
  <include file="http.zcml" />
  <include package=".Browser" />
</zopeConfigure>


=== Added File Zope3/src/zope/app/publisher/fileresource.py ===
##############################################################################
#
# Copyright (c) 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.
# 
##############################################################################
"""

$Id: fileresource.py,v 1.1.2.1 2002/12/23 19:32:01 jim Exp $
"""
__metaclass__ = type # All classes are new style when run with Python 2.2+


from zope.app.content_types import guess_content_type
from zope.app.package_home import package_home
from zope.app.datetime import rfc1123_date
from zope.exceptions import NotFoundError
from time import time
from os import stat
import os

class File:
    """Image objects stored in external files."""

    def __init__(self, path):

        self.path=path

        file=open(path, 'rb')
        data=file.read()
        file.close()
        self.content_type, enc = guess_content_type(path, data)
        self.__name__=path[path.rfind('/')+1:]
        self.lmt=float(stat(path)[8]) or time()
        self.lmh=rfc1123_date(self.lmt)

class Image(File):

    def __init__(self, path):
        super(Image, self).__init__(path)
        if self.content_type in (None,  'application/octet-stream'):
            ext = os.path.splitext(self.path)[1]
            if ext:
                self.content_type='image/%s' % ext[1:]
    


=== Added File Zope3/src/zope/app/publisher/http.zcml ===
<zopeConfigure
   xmlns='http://namespaces.zope.org/zope'
   package="Zope.Publisher.HTTP"
>

  <content class="zope.publisher.http.HTTPRequest">
    <require
        permission="Zope.View"
        interface="zope.publisher.interfaces.http.IHTTPApplicationRequest"/>
  </content>

  <content class="zope.publisher.http.URLGetter">
    <require
        permission="Zope.View" 
        attributes="get __getitem__ __str__" />
  </content>

</zopeConfigure>


=== Added File Zope3/src/zope/app/publisher/meta.zcml ===
<zopeConfigure
   xmlns='http://namespaces.zope.org/zope'
   xmlns:browser='http://namespaces.zope.org/browser'
   >

  <include package=".Browser" file="meta.zcml" />
  <include package=".XMLRPC" file="meta.zcml" />
  <include package=".VFS" file="meta.zcml" />

</zopeConfigure>