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

Jim Fulton jim@zope.com
Wed, 25 Dec 2002 09:14:10 -0500


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

Added Files:
	__init__.py configure.zcml fileresource.py http.zcml meta.zcml 
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/app/publisher/__init__.py 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:10 2002
+++ Zope3/src/zope/app/publisher/__init__.py	Wed Dec 25 09:13:09 2002
@@ -0,0 +1,2 @@
+#
+# This file is necessary to make this directory a package.


=== Zope3/src/zope/app/publisher/configure.zcml 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:10 2002
+++ Zope3/src/zope/app/publisher/configure.zcml	Wed Dec 25 09:13:09 2002
@@ -0,0 +1,5 @@
+<zopeConfigure xmlns='http://namespaces.zope.org/zope' >
+  <include package=".browser" />
+  <!-- XXX Decoy: include package='.xmlrpc' / -->
+  <include file="http.zcml" />
+</zopeConfigure>


=== Zope3/src/zope/app/publisher/fileresource.py 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:10 2002
+++ Zope3/src/zope/app/publisher/fileresource.py	Wed Dec 25 09:13:09 2002
@@ -0,0 +1,51 @@
+##############################################################################
+#
+# 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$
+"""
+__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.datetimeutils 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:]


=== Zope3/src/zope/app/publisher/http.zcml 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:10 2002
+++ Zope3/src/zope/app/publisher/http.zcml	Wed Dec 25 09:13:09 2002
@@ -0,0 +1,18 @@
+<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>


=== Zope3/src/zope/app/publisher/meta.zcml 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:10 2002
+++ Zope3/src/zope/app/publisher/meta.zcml	Wed Dec 25 09:13:09 2002
@@ -0,0 +1,10 @@
+<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>