[Zope3-checkins] CVS: Zope3/src/zope/app/vfs/content - __init__.py:1.1.2.1 configure.zcml:1.1.2.1 dtmlpageadd.py:1.1.2.1 dtmlpageview.py:1.1.2.1 file.py:1.1.2.1 folder.py:1.1.2.1 sql.py:1.1.2.1 zpt.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
In directory cvs.zope.org:/tmp/cvs-serv19908/zope/app/vfs/content
Added Files:
Tag: NameGeddon-branch
__init__.py configure.zcml dtmlpageadd.py dtmlpageview.py
file.py folder.py sql.py zpt.py
Log Message:
Initial renaming before debugging
=== Added File Zope3/src/zope/app/vfs/content/__init__.py ===
#
# This file is necessary to make this directory a package.
=== Added File Zope3/src/zope/app/vfs/content/configure.zcml ===
<zopeConfigure
xmlns="http://namespaces.zope.org/zope"
xmlns:vfs="http://namespaces.zope.org/vfs">
<vfs:view name="vfs"
for="zope.app.content.dtmlpage.IDTMLPage"
permission="Zope.View"
allowed_interface="zope.publisher.interfaces.vfs.IVFSFilePublisher"
factory="zope.app.vfs.content.dtmlpageview.DTMLPageView" />
<vfs:view
name=".dtml"
for="zope.app.interfaces.container.IAdding"
factory="zope.app.vfs.content.dtmlpageadd.DTMLPageAdd"
permission="Zope.ManageContent" />
</zopeConfigure>
<zopeConfigure
xmlns="http://namespaces.zope.org/zope"
xmlns:vfs="http://namespaces.zope.org/vfs">
<vfs:view name="vfs"
for="zope.app.content.zpt.IZPTPage"
permission="Zope.View"
allowed_interface="zope.publisher.interfaces.vfs.IVFSFilePublisher"
factory="zope.app.vfs.content.zpt.ZPTPageView" />
<vfs:view
name=".pt"
for="zope.app.interfaces.container.IAdding"
factory="zope.app.vfs.content.zpt.ZPTPageAdd"
permission="Zope.ManageContent" />
<vfs:view
name=".zpt"
for="zope.app.interfaces.container.IAdding"
factory="zope.app.vfs.content.zpt.ZPTPageAdd"
permission="Zope.ManageContent" />
</zopeConfigure>
<zopeConfigure
xmlns="http://namespaces.zope.org/zope"
xmlns:vfs="http://namespaces.zope.org/vfs"
>
<vfs:view
name="Folder"
for="zope.app.interfaces.container.IAdding"
factory="zope.app.vfs.content.folder.FolderAdd"
permission="Zope.ManageContent" />
<vfs:view
name="vfs"
for="zope.app.content.folder.IFolder"
permission="Zope.ManageContent"
allowed_interface="zope.publisher.interfaces.vfs.IVFSDirectoryPublisher"
factory="zope.app.vfs.content.folder.FolderView"
/>
</zopeConfigure>
<zopeConfigure
xmlns="http://namespaces.zope.org/zope"
xmlns:vfs="http://namespaces.zope.org/vfs">
<vfs:view name="vfs"
for="zope.app.content.sql.ISQLScript"
permission="Zope.View"
allowed_interface="zope.publisher.interfaces.vfs.IVFSFilePublisher"
factory="zope.app.vfs.content.sql.SQLScriptView" />
<vfs:view
name=".sql"
for="zope.app.interfaces.container.IAdding"
factory="zope.app.vfs.content.sql.SQLScriptAdd"
permission="Zope.ManageContent" />
<vfs:view
name=".zsql"
for="zope.app.interfaces.container.IAdding"
factory="zope.app.vfs.content.sql.SQLScriptAdd"
permission="Zope.ManageContent" />
</zopeConfigure>
<zopeConfigure
xmlns="http://namespaces.zope.org/zope"
xmlns:vfs="http://namespaces.zope.org/vfs"
>
<vfs:view name="vfs"
for="zope.app.interfaces.content.file.IFile"
permission="Zope.View"
allowed_interface="zope.publisher.interfaces.vfs.IVFSFilePublisher"
factory="zope.app.vfs.content.file.FileView" />
<!-- Generic File Adder -->
<vfs:view
name="."
for="zope.app.interfaces.container.IAdding"
factory="zope.app.vfs.content.file.FileAdd"
permission="Zope.ManageContent" />
</zopeConfigure>
=== Added File Zope3/src/zope/app/vfs/content/dtmlpageadd.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 DTMLPage Add View
$Id: dtmlpageadd.py,v 1.1.2.1 2002/12/23 19:32:36 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.dtmlpage import DTMLPage
class DTMLPageAdd(VFSView):
"Provide a user interface for adding a DTMLPage content object"
__used_for__ = IAdding
def __call__(self, mode, instream, start):
content = DTMLPage()
try:
instream.seek(start)
except:
pass
content.setSource(instream.read())
publish(self.context, ObjectCreatedEvent(content))
return self.context.add(content)
=== Added File Zope3/src/zope/app/vfs/content/dtmlpageview.py ===
##############################################################################
#
# 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.
#
##############################################################################
"""VFS-View for IDTMLPage
VFS-view implementation for a DTML Page.
$Id: dtmlpageview.py,v 1.1.2.1 2002/12/23 19:32:36 jim Exp $
"""
from zope.publisher.vfs import VFSFileView
class DTMLPageView(VFSFileView):
def _setData(self, data):
self.context.setSource(data)
def _getData(self):
return self.context.getSource()
=== Added File Zope3/src/zope/app/vfs/content/file.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 File Add View
$Id: file.py,v 1.1.2.1 2002/12/23 19:32:36 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.file import File
class FileAdd(VFSView):
"Provide a user interface for adding a File content object"
__used_for__ = IAdding
def __call__(self, mode, instream, start):
"Add a contact"
content = File()
try:
instream.seek(start)
except:
pass
content.setData(instream.read())
publish(self.context, ObjectCreatedEvent(content))
return self.context.add(content)
"""VFS-View for IFile
VFS-view implementation for a generic file.
$Id: file.py,v 1.1.2.1 2002/12/23 19:32:36 jim Exp $
"""
from zope.publisher.vfs import VFSFileView
class FileView(VFSFileView):
def _setData(self, data):
self.context.setData(data)
def _getData(self):
return self.context.getData()
def _getSize(self):
return self.context.getSize()
=== Added File Zope3/src/zope/app/vfs/content/folder.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 Folder Add View
$Id: folder.py,v 1.1.2.1 2002/12/23 19:32:36 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.folder import Folder
class FolderAdd(VFSView):
"Provide a user interface for adding a Folder content object"
__used_for__ = IAdding
def __call__(self):
"Add a folder"
content = Folder()
publish(self.context, ObjectCreatedEvent(content))
return self.context.add(content)
"""VFS-View for IFolder
$Id: folder.py,v 1.1.2.1 2002/12/23 19:32:36 jim Exp $
"""
import datetime
zerotime = datetime.datetime.fromtimestamp(0)
from zope.component import getAdapter
from zope.app.interfaces.dublincore import IZopeDublinCore
from zope.app.vfs.container.view import \
VFSContainerView
class FolderView(VFSContainerView):
"""Specific Folder VFS view."""
__implments__ = VFSContainerView.__implements__
_directory_type = 'Folder'
def _getServiceManagerStat(self):
"""Get the stat information of the local service manager."""
# XXX ServiceManager does not use the DublinCore to keep track of its
# creation and modification times, so we use the data of the Folder
# right now.
dc = getAdapter(self.context, IZopeDublinCore)
if dc is not None:
created = dc.created
modified = dc.modified
else:
created = zerotime
modified = zerotime
if modified is None:
modified = created
dir_mode = 16384 + 504
uid = "nouser"
gid = "nogroup"
return (dir_mode, 0, 0, 0, uid, gid, 4096, modified, modified,
created)
def exists(self, name):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
if self.context.hasServiceManager() and name == '++etc++Services':
return True
return super(FolderView, self).exists(name)
def listdir(self, with_stats=0, pattern='*'):
'See Zope.Publisher.VFS.IVFSDirectoryPublisher.IVFSDirectoryPublisher'
result = super(FolderView, self).listdir(with_stats, pattern)
if self.context.hasServiceManager():
result = [('++etc++Services', self._getServiceManagerStat())] \
+ result
return result
=== Added File Zope3/src/zope/app/vfs/content/sql.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 SQLScript Add View
$Id: sql.py,v 1.1.2.1 2002/12/23 19:32:36 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.sql import SQLScript
class SQLScriptAdd(VFSView):
"Provide a user interface for adding a SQLScript content object"
__used_for__ = IAdding
def __call__(self, mode, instream, start):
content = SQLScript()
try:
instream.seek(start)
except:
pass
content.setSource(instream.read())
publish(self.context, ObjectCreatedEvent(content))
return self.context.add(content)
"""VFS-View for ISQLScript
VFS-view implementation for a ZPT Page.
$Id: sql.py,v 1.1.2.1 2002/12/23 19:32:36 jim Exp $
"""
from zope.publisher.vfs import VFSFileView
class SQLScriptView(VFSFileView):
def _setData(self, data):
self.context.setSource(data)
def _getData(self):
return self.context.getSource()
=== Added File Zope3/src/zope/app/vfs/content/zpt.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 ZPTPage Add View
$Id: zpt.py,v 1.1.2.1 2002/12/23 19:32:36 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.zpt import ZPTPage
class ZPTPageAdd(VFSView):
"Provide a user interface for adding a ZPTPage content object"
__used_for__ = IAdding
def __call__(self, mode, instream, start):
content = ZPTPage()
try:
instream.seek(start)
except:
pass
content.setSource(unicode(instream.read()))
publish(self.context, ObjectCreatedEvent(content))
return self.context.add(content)
"""VFS-View for IZPTPage
VFS-view implementation for a ZPT Page.
$Id: zpt.py,v 1.1.2.1 2002/12/23 19:32:36 jim Exp $
"""
from zope.publisher.vfs import VFSFileView
class ZPTPageView(VFSFileView):
def _setData(self, data):
self.context.setSource(data)
def _getData(self):
return self.context.getSource()