[CMF-checkins] CVS: CMF - MsOfficeFile.py:1.1 PTKLibOle2.stx:1.1 PyLibOle2.py:1.1

jack@digicool.com jack@digicool.com
Wed, 30 May 2001 15:10:00 -0400 (EDT)


Update of /cvs-repository/Packages/Products/DCProject/CMF_MS_Files/help
In directory korak.digicool.com:/tmp/cvs-serv13492

Added Files:
	MsOfficeFile.py PTKLibOle2.stx PyLibOle2.py 
Log Message:
Adding CMF_MS_Files Product



--- Added File MsOfficeFile.py in package Packages/Products/DCProject ---
##############################################################################
# 
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
# 
# Copyright (c) Digital Creations.  All rights reserved.
# 
# This license has been certified as Open Source(tm).
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions in source code must retain the above copyright
#    notice, this list of conditions, and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions, and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 
# 3. Digital Creations requests that attribution be given to Zope
#    in any manner possible. Zope includes a "Powered by Zope"
#    button that is installed by default. While it is not a license
#    violation to remove this button, it is requested that the
#    attribution remain. A significant investment has been put
#    into Zope, and this effort will continue if the Zope community
#    continues to grow. This is one way to assure that growth.
# 
# 4. All advertising materials and documentation mentioning
#    features derived from or use of this software must display
#    the following acknowledgement:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    In the event that the product being advertised includes an
#    intact Zope distribution (with copyright and license included)
#    then this clause is waived.
# 
# 5. Names associated with Zope or Digital Creations must not be used to
#    endorse or promote products derived from this software without
#    prior written permission from Digital Creations.
# 
# 6. Modified redistributions of any form whatsoever must retain
#    the following acknowledgment:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    Intact (re-)distributions of any official Zope release do not
#    require an external acknowledgement.
# 
# 7. Modifications are encouraged but must be packaged separately as
#    patches to official Zope releases.  Distributions that do not
#    clearly separate the patches from the original work must be clearly
#    labeled as unofficial distributions.  Modifications which do not
#    carry the name Zope may be packaged in any form, as long as they
#    conform to all of the clauses above.
# 
# 
# Disclaimer
# 
#   THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
#   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
#   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
#   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#   SUCH DAMAGE.
# 
# 
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations.  Specific
# attributions are listed in the accompanying credits file.
# 
##############################################################################
 
"""
This module implements a portal-managed MsOffice File class.  It is based on
Zope's built-in File object, but modifies the behaviour slightly to
make it more Portal-friendly. It also extracts some header info from the ole
wrapper information in the file.
"""

def addFile( self
           , id
           , file
           , title=''
           , description=''
           , precondition=''
           , content_type=''
           , subject=()
           , contributors=()
           , effective_date=None
           , expiration_date=None
           , format='text/html'
           , language='en-US'
           , rights=''
           , RESPONSE=None
           ):
    """
    Add a File
    """
class MsOfficeFile:
    """
    This is a class that is based on the File class from the PTK.
    This class contains a PUT call that gets invoked via the 
    'hookable PUT' functionality.  
    """

    def SearchableText(self):
        """
        SeachableText is used for full text seraches of a portal.  It
        should return a concatanation of all useful text.
        """

    def listActions(self, info):
        """
        list of Actions that this MsOfficeFile object can take
        """

    def manage_afterAdd(self, item, container):
        """
        Both of my parents have an afterAdd method
        """

    def manage_beforeDelete(self, item, container):
        """
        Both of my parents have a beforeDelete method
        """

    def edit(self, title, description, content_type,
             precondition='', file='', REQUEST=None):
        """
        Perform changes for user
        """

    def download(self, REQUEST, RESPONSE):
        """
        Download this item.  Calls OFS.Image.File.index_html to perform the
        actual transfer after first setting Content-Disposition to suggest
        a filename.
        """

    def PUT(self, REQUEST, RESPONSE):
        """
        Handle HTTP (and presumably FTP?) PUT requests
        """

--- Added File PTKLibOle2.stx in package Packages/Products/DCProject ---
PTK LibOle2 Product version 0.1

    This is the documentation to the PTK LibOle2 product.

    The main goal of this product is to allow users to 
    'drop' MS Office type documents into a portal and be
    able to extract useful metadata from that document so
    that it will be found in a search, and function just 
    as any other type of Portal File.

    Once this product is installed, the user does not need to
    instantiate anything, the functionality described above
    will happen on any 'PUTS' of office type files into a portal.

    PyLibOle2 is a Python module that wraps the pyLibOle2.so.
    pyLibOle2.so can be used on MS Office type files to extract
    metadata.

    This product wraps and includes that library.  The wrap is a python
    module - PyLibOle2.py.  This module contains one simple method -
    getHeaders - that takes the body of a file and a dictionary of 
    header information.  getHeaders will add to that dictionary the
    following metadata:
 

-    Title

-    Subject

-    Publisher

-    Description

-    Contributors (author)

-    Effective Date

-    Expiration Date

-    Rights



  Prerequisites

    For Installation and Configuration

      Access to the filesystem which houses the Zope installation.

      PTKBase must be successfully installed on your installation.

  Installation

    Untar and ungzip the PTKLibOle2-0-1.tgz file into your
    Zope directory.

    NOTE: if you use an INSTANCE_HOME setup, you may
    alternately untar and ungzip the CoreSessionTracking product into
    your INSTANCE_HOME/Products directory.

  Configuration

       None


--- Added File PyLibOle2.py in package Packages/Products/DCProject ---
"""
This file contains one method - getHeaders that creates
or modifies a dictionary - headers that is passed in.
headers is a dictionary of document attribute, document value
pairs.

"""

def getHeaders(body, headers):
    """
    This method calls PyLibOle2 to extract metadata from 
    a MS Office type document and returns the values in 
    the headers dictionary
    """




--- Added File MsOfficeFile.py in package CMF ---
##############################################################################
# 
# Zope Public License (ZPL) Version 1.0
# -------------------------------------
# 
# Copyright (c) Digital Creations.  All rights reserved.
# 
# This license has been certified as Open Source(tm).
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# 1. Redistributions in source code must retain the above copyright
#    notice, this list of conditions, and the following disclaimer.
# 
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions, and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
# 
# 3. Digital Creations requests that attribution be given to Zope
#    in any manner possible. Zope includes a "Powered by Zope"
#    button that is installed by default. While it is not a license
#    violation to remove this button, it is requested that the
#    attribution remain. A significant investment has been put
#    into Zope, and this effort will continue if the Zope community
#    continues to grow. This is one way to assure that growth.
# 
# 4. All advertising materials and documentation mentioning
#    features derived from or use of this software must display
#    the following acknowledgement:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    In the event that the product being advertised includes an
#    intact Zope distribution (with copyright and license included)
#    then this clause is waived.
# 
# 5. Names associated with Zope or Digital Creations must not be used to
#    endorse or promote products derived from this software without
#    prior written permission from Digital Creations.
# 
# 6. Modified redistributions of any form whatsoever must retain
#    the following acknowledgment:
# 
#      "This product includes software developed by Digital Creations
#      for use in the Z Object Publishing Environment
#      (http://www.zope.org/)."
# 
#    Intact (re-)distributions of any official Zope release do not
#    require an external acknowledgement.
# 
# 7. Modifications are encouraged but must be packaged separately as
#    patches to official Zope releases.  Distributions that do not
#    clearly separate the patches from the original work must be clearly
#    labeled as unofficial distributions.  Modifications which do not
#    carry the name Zope may be packaged in any form, as long as they
#    conform to all of the clauses above.
# 
# 
# Disclaimer
# 
#   THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS ``AS IS'' AND ANY
#   EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
#   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
#   PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DIGITAL CREATIONS OR ITS
#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
#   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
#   SUCH DAMAGE.
# 
# 
# This software consists of contributions made by Digital Creations and
# many individuals on behalf of Digital Creations.  Specific
# attributions are listed in the accompanying credits file.
# 
##############################################################################
 
"""
This module implements a portal-managed MsOffice File class.  It is based on
Zope's built-in File object, but modifies the behaviour slightly to
make it more Portal-friendly. It also extracts some header info from the ole
wrapper information in the file.
"""

def addFile( self
           , id
           , file
           , title=''
           , description=''
           , precondition=''
           , content_type=''
           , subject=()
           , contributors=()
           , effective_date=None
           , expiration_date=None
           , format='text/html'
           , language='en-US'
           , rights=''
           , RESPONSE=None
           ):
    """
    Add a File
    """
class MsOfficeFile:
    """
    This is a class that is based on the File class from the PTK.
    This class contains a PUT call that gets invoked via the 
    'hookable PUT' functionality.  
    """

    def SearchableText(self):
        """
        SeachableText is used for full text seraches of a portal.  It
        should return a concatanation of all useful text.
        """

    def listActions(self, info):
        """
        list of Actions that this MsOfficeFile object can take
        """

    def manage_afterAdd(self, item, container):
        """
        Both of my parents have an afterAdd method
        """

    def manage_beforeDelete(self, item, container):
        """
        Both of my parents have a beforeDelete method
        """

    def edit(self, title, description, content_type,
             precondition='', file='', REQUEST=None):
        """
        Perform changes for user
        """

    def download(self, REQUEST, RESPONSE):
        """
        Download this item.  Calls OFS.Image.File.index_html to perform the
        actual transfer after first setting Content-Disposition to suggest
        a filename.
        """

    def PUT(self, REQUEST, RESPONSE):
        """
        Handle HTTP (and presumably FTP?) PUT requests
        """

--- Added File PTKLibOle2.stx in package CMF ---
PTK LibOle2 Product version 0.1

    This is the documentation to the PTK LibOle2 product.

    The main goal of this product is to allow users to 
    'drop' MS Office type documents into a portal and be
    able to extract useful metadata from that document so
    that it will be found in a search, and function just 
    as any other type of Portal File.

    Once this product is installed, the user does not need to
    instantiate anything, the functionality described above
    will happen on any 'PUTS' of office type files into a portal.

    PyLibOle2 is a Python module that wraps the pyLibOle2.so.
    pyLibOle2.so can be used on MS Office type files to extract
    metadata.

    This product wraps and includes that library.  The wrap is a python
    module - PyLibOle2.py.  This module contains one simple method -
    getHeaders - that takes the body of a file and a dictionary of 
    header information.  getHeaders will add to that dictionary the
    following metadata:
 

-    Title

-    Subject

-    Publisher

-    Description

-    Contributors (author)

-    Effective Date

-    Expiration Date

-    Rights



  Prerequisites

    For Installation and Configuration

      Access to the filesystem which houses the Zope installation.

      PTKBase must be successfully installed on your installation.

  Installation

    Untar and ungzip the PTKLibOle2-0-1.tgz file into your
    Zope directory.

    NOTE: if you use an INSTANCE_HOME setup, you may
    alternately untar and ungzip the CoreSessionTracking product into
    your INSTANCE_HOME/Products directory.

  Configuration

       None


--- Added File PyLibOle2.py in package CMF ---
"""
This file contains one method - getHeaders that creates
or modifies a dictionary - headers that is passed in.
headers is a dictionary of document attribute, document value
pairs.

"""

def getHeaders(body, headers):
    """
    This method calls PyLibOle2 to extract metadata from 
    a MS Office type document and returns the values in 
    the headers dictionary
    """