[Zope3-checkins] CVS: Zope3/src/zope/app/vfs/content/image - __init__.py:1.1.2.1 configure.zcml:1.1.2.1 image.py:1.1.2.1

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


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

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

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


=== Added File Zope3/src/zope/app/vfs/content/image/configure.zcml ===
<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>


=== Added File Zope3/src/zope/app/vfs/content/image/image.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.
#
##############################################################################
"""VFS Image Add View

$Id: image.py,v 1.1.2.1 2002/12/23 19:32:37 jim Exp $
"""
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)