[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/ZPTPage - ZPTPage.py:1.1.2.1 ZPTPageFields.py:1.1.2.1 __init__.py:1.1.2.1 zptpage.zcml:1.1.2.1

Stephan Richter srichter@cbu.edu
Wed, 27 Mar 2002 10:54:42 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/ZPTPage
In directory cvs.zope.org:/tmp/cvs-serv12282/Content/ZPTPage

Added Files:
      Tag: Zope-3x-branch
	ZPTPage.py ZPTPageFields.py __init__.py zptpage.zcml 
Log Message:
New Content Objects:

- NaiveFile --> all the data is stored in one string
- File --> Uses a BTree to store the data in chunks (more efficient)
- Image --> Can store and display an image a la Z2 (based on File)
- ZPTPage --> A simple version of ZPT for the content space to allow some 
  dynamics data (please do not use this for scripting)

Also:

- Expansion of supported views
- all edit screens are Formulator supported



=== Added File Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/ZPTPage.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 1.1 (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: ZPTPage.py,v 1.1.2.1 2002/03/27 15:54:40 srichter Exp $
"""

from Interface import Interface
from Persistence import Persistent
from Zope.PageTemplate.ZPT import ZPT
from Zope.App.Security.IAttributeRolePermissionManageable \
     import IAttributeRolePermissionManageable


class IZPTPage(Interface):
    """ZPT Pages are a persistent implementation of Page Templates.

       Note: I introduced some new methods whose functionality is
             actually already covered by some other methods but I
             want to start inforcing a common coding standard.
    """

    def setSource(text):
        """Save the source of the page template.
        """


    def getSource():
        """Get the source of the page template.
        """



class ZPTPage(Persistent, ZPT):
    """ """

    __implements__ = (IZPTPage,
                      IAttributeRolePermissionManageable)

    def __init__(self, text=''):
        """ """
        self.setSource(text)


    ############################################################
    # Implementation methods for interface
    # Zope.App.OFS.ZPTPage.ZPTPage.IZPTPage

    def getSource(self):
        '''See interface IZPTPage'''
        return self.read()


    def setSource(self, text):
        '''See interface IZPTPage'''
        self.pt_edit(text, 'text/html')

    #
    ############################################################

    _need__name__=1
    _v_last_read = 0

    _default_bindings = {'name_subpath': 'traverse_subpath'}


=== Added File Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/ZPTPageFields.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
# 
##############################################################################
"""

$Id: ZPTPageFields.py,v 1.1.2.1 2002/03/27 15:54:40 srichter Exp $
"""

from Zope.App.Formulator.FieldRegistry import getField
from Zope.App.Formulator.ValidatorRegistry import getValidator


SourceField = getField('StringField')(
    id = 'source',
    title = 'ZPT Page Source',
    description = 'Page Template Source Code',
    default = ''
    )


=== Added File Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/__init__.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 1.1 (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: __init__.py,v 1.1.2.1 2002/03/27 15:54:40 srichter Exp $
"""


=== Added File Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/zptpage.zcml ===
<zopeConfigure
   xmlns='http://namespaces.zope.org/zope'
   xmlns:security='http://namespaces.zope.org/security'
   xmlns:browser='http://namespaces.zope.org/browser'
   xmlns:zmi='http://namespaces.zope.org/zmi'
>

  <security:permission permission_id="Zope.AddZPTPages" 
                       title="Add ZPT Pages" />

  <zmi:provideClass name=".ZPTPage."
                    permission_id="Zope.AddZPTPages"
                    title="ZPT Page"
                    description="A simple, content-based Page Template" />


  <security:protectClass name=".ZPTPage."
    permission_id="Zope.View" />

  <!-- tabs for ZPT Page -->

  <zmi:tabs for=".ZPTPage.IZPTPage.">
    <zmi:tab label="View" action=""/>
    <zmi:tab label="Edit" action="edit;view"/>
    <zmi:tab label="Role Permissions" action="RolePermissionsManagement;view"/>
  </zmi:tabs>

  <include package=".Views" file="views.zcml" />



</zopeConfigure>