[Zope3-checkins] CVS: Zope3/src/zope/products/folder - __init__.py:1.1.2.1 browser.py:1.1.2.1 configure.zcml:1.1.2.1 folder_icon.gif:1.1.2.1 fssync.py:1.1.2.1

Philipp von Weitershausen philikon at philikon.de
Wed Feb 11 11:29:22 EST 2004


Update of /cvs-repository/Zope3/src/zope/products/folder
In directory cvs.zope.org:/tmp/cvs-serv21715/folder

Added Files:
      Tag: philikon-movecontent-branch
	__init__.py browser.py configure.zcml folder_icon.gif 
	fssync.py 
Log Message:
Get rid of zope.products.content and zope.products.codecontent and move
content components in their own packages at zope.products.

See the package geddon proposal: http://dev.zope.org/Zope3/PackageGeddon


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


=== Added File Zope3/src/zope/products/folder/browser.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.
#
##############################################################################
"""Felder-spcific view classes

$Id: browser.py,v 1.1.2.1 2004/02/11 16:29:21 philikon Exp $
"""
from zope.interface import implements
from zope.app.browser.container.adding import Adding
from zope.app.interfaces.folder import IFolderAdding

#XXX this is currently not used

class FolderAdding(Adding):
    implements(IFolderAdding)


=== Added File Zope3/src/zope/products/folder/configure.zcml ===
<configure
    xmlns='http://namespaces.zope.org/zope'
    xmlns:browser='http://namespaces.zope.org/browser'
    xmlns:fssync='http://namespaces.zope.org/fssync'
    i18n_domain='zope'
    >

  <!-- Module alias for backward compat -->

  <modulealias
      module="zope.app.folder"
      alias="zope.app.content.folder"
      />


  <interface 
      interface="zope.app.interfaces.folder.IFolder" 
      type="zope.app.interfaces.content.IContentType"
      /> 

  <content class="zope.app.folder.Folder">
    <implements
        interface="zope.app.interfaces.container.IContentContainer"
        />

    <implements
        interface="zope.app.interfaces.annotation.IAttributeAnnotatable"
        />

    <factory
        id="Folder"
        permission="zope.ManageContent"
        title="Folder"
        description="Minimal folder"
        />

    <allow
        attributes="getSiteManager"
        />

    <require
        permission="zope.ManageServices"
        attributes="setSiteManager"
        />

    <require
        permission="zope.View"
        interface="zope.app.interfaces.container.IReadContainer" 
        />

    <require
        permission="zope.ManageContent"
        interface="zope.app.interfaces.container.IWriteContainer"
        />
  </content>

  <adapter
      for="zope.app.interfaces.folder.IFolder"
      provides="zope.app.interfaces.file.IDirectoryFactory"
      factory="zope.app.container.directory.Cloner"
      permission="zope.ManageContent"
      />

  <adapter
      for="zope.app.interfaces.folder.IFolder"
      provides="zope.app.interfaces.file.IReadDirectory"
      factory=".fssync.ReadDirectory"
      permission="zope.View"
      />

  <fssync:adapter
      class="zope.app.folder.Folder"
      factory=".fssync.FolderAdapter"
      />


  <!-- browser directives -->

  <browser:icon
      name="zmi_icon"
      for="zope.app.interfaces.folder.IFolder"
      file="folder_icon.gif"
      />

  <browser:addMenuItem
      class="zope.app.folder.Folder"
      title="Folder"
      permission="zope.ManageContent"
      />

  <browser:page
      name="contents.html"
      menu="zmi_views" title="Contents"
      for="zope.app.interfaces.folder.IFolder"
      permission="zope.ManageContent"
      class="zope.app.browser.container.contents.Contents"
      attribute="contents"
      />

  <browser:page
      name="index.html"
      for="zope.app.interfaces.folder.IFolder"
      permission="zope.View"
      class="zope.app.browser.container.contents.Contents"
      attribute="index"
      />

  <!--browser:page
      for="zope.app.interfaces.folder.IFolder"
      name="preview.html"
      menu="zmi_views" title="Preview"
      template="preview.pt"
      permission="zope.ManageContent"
      /-->

</configure>


=== Added File Zope3/src/zope/products/folder/folder_icon.gif ===
  <Binary-ish file>

=== Added File Zope3/src/zope/products/folder/fssync.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.
# 
##############################################################################
"""Filesystem synchronization support.

$Id: fssync.py,v 1.1.2.1 2004/02/11 16:29:21 philikon Exp $
"""

from zope.interface import implements
from zope.fssync.server.entryadapter import ObjectEntryAdapter, \
     DirectoryAdapter, AttrMapping
from zope.fssync.server.interfaces import IContentDirectory

__metaclass__ = type

class RootDirectoryFactory:

    def __init__(self, context):
        pass

    def __call__(self, name):
        return Folder()

class ReadDirectory:
    """Adapter to provide a file-system rendition of folders
    """

    def __init__(self, context):
        self.context = context

    def keys(self):
        keys = self.context.keys()
        if ISite.isImplementedBy(self.context):
            return list(keys) + ['++etc++site']
        return keys

    def get(self, key, default=None):
        if key == '++etc++site' and ISite.isImplementedBy(self.context):
            return self.context.getSiteManager()

        return self.context.get(key, default)

    def __iter__(self):
        return iter(self.keys())

    def __getitem__(self, key):
        v = self.get(key, self)
        if v is self:
            raise KeyError, key
        return v

    def values(self):
        return map(self.get, self.keys())

    def __len__(self):
        l = len(self.context)
        if ISite.isImplementedBy(self.context):
            l += 1
        return l

    def items(self):
        get = self.get
        return [(key, get(key)) for key in self.keys()]

    def __contains__(self, key):
        return self.get(key) is not None

class FolderAdapter(DirectoryAdapter):
    """Adapter to provide an fssync interpretation of folders
    """

    def contents(self):
        result = super(FolderAdapter, self).contents()
        if ISite.isImplementedBy(self.context):
            sm = self.context.getSiteManager()
            result.append(('++etc++site', sm))
        return result




More information about the Zope3-Checkins mailing list