[Zope3-checkins] CVS: Zope3/src/zope/app/vfs/content/image - __init__.py:1.2 configure.zcml:1.2 image.py:1.2
Jim Fulton
jim@zope.com
Wed, 25 Dec 2002 09:14:00 -0500
Update of /cvs-repository/Zope3/src/zope/app/vfs/content/image
In directory cvs.zope.org:/tmp/cvs-serv15352/src/zope/app/vfs/content/image
Added Files:
__init__.py configure.zcml image.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/app/vfs/content/image/__init__.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:00 2002
+++ Zope3/src/zope/app/vfs/content/image/__init__.py Wed Dec 25 09:13:29 2002
@@ -0,0 +1,2 @@
+#
+# This file is necessary to make this directory a package.
=== Zope3/src/zope/app/vfs/content/image/configure.zcml 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:00 2002
+++ Zope3/src/zope/app/vfs/content/image/configure.zcml Wed Dec 25 09:13:29 2002
@@ -0,0 +1,23 @@
+<zopeConfigure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:vfs="http://namespaces.zope.org/vfs">
+
+ <vfs:view
+ name=".png"
+ for="zope.app.interfaces.container.IAdding"
+ factory="zope.app.vfs.content.image.image.ImageAdd"
+ permission="zope.ManageContent" />
+
+ <vfs:view
+ name=".gif"
+ for="zope.app.interfaces.container.IAdding"
+ factory="zope.app.vfs.content.image.image.ImageAdd"
+ permission="zope.ManageContent" />
+
+ <vfs:view
+ name=".bmp"
+ for="zope.app.interfaces.container.IAdding"
+ factory="zope.app.vfs.content.image.image.ImageAdd"
+ permission="zope.ManageContent" />
+
+</zopeConfigure>
=== Zope3/src/zope/app/vfs/content/image/image.py 1.1 => 1.2 ===
--- /dev/null Wed Dec 25 09:14:00 2002
+++ Zope3/src/zope/app/vfs/content/image/image.py Wed Dec 25 09:13:29 2002
@@ -0,0 +1,41 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""VFS Image Add View
+
+$Id$
+"""
+from zope.publisher.vfs import VFSView
+
+from zope.event import publish
+from zope.app.event.objectevent import ObjectCreatedEvent
+
+from zope.app.interfaces.container import IAdding
+from zope.app.content.image import Image
+
+
+class ImageAdd(VFSView):
+ "Provide a user interface for adding a Image content object"
+
+ __used_for__ = IAdding
+
+ def __call__(self, mode, instream, start):
+ content = Image()
+ try:
+ instream.seek(start)
+ except:
+ pass
+ content.setData(instream.read())
+
+ publish(self.context, ObjectCreatedEvent(content))
+ return self.context.add(content)