[Zope-CVS] CVS: Products/AdaptableStorage/serial_ofs - FilePData.py:1.1 public.py:1.3

Shane Hathaway shane@zope.com
Wed, 11 Dec 2002 18:07:24 -0500


Update of /cvs-repository/Products/AdaptableStorage/serial_ofs
In directory cvs.zope.org:/tmp/cvs-serv13423/serial_ofs

Modified Files:
	public.py 
Added Files:
	FilePData.py 
Log Message:
Added mappers for page templates, images, and files, making the claim of
custom formats more believable.


=== Added File Products/AdaptableStorage/serial_ofs/FilePData.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.
#
##############################################################################
"""Aspect for working with the 'data' attribute of OFS.File and OFS.Image

$Id: FilePData.py,v 1.1 2002/12/11 23:07:23 shane Exp $
"""

from types import StringType

from serial_public import IAspectSerializer, FieldSchema


class FilePData:
    __implements__ = IAspectSerializer

    schema = FieldSchema('data', 'string')

    def getSchema(self):
        return self.schema

    def serialize(self, object, event):
        event.notifySerialized('data', object.data, 1)
        event.ignoreAttribute('size')
        event.ignoreAttribute('width')
        event.ignoreAttribute('height')
        return str(object.data)

    def deserialize(self, object, event, state):
        data, size = object._read_data(state)
        content_type = object._get_content_type(state, data, object.__name__)
        object.update_data(data, content_type, size)
        event.notifyDeserialized('data', object.data)



=== Products/AdaptableStorage/serial_ofs/public.py 1.2 => 1.3 ===
--- Products/AdaptableStorage/serial_ofs/public.py:1.2	Tue Dec 10 15:35:57 2002
+++ Products/AdaptableStorage/serial_ofs/public.py	Wed Dec 11 18:07:23 2002
@@ -16,6 +16,7 @@
 $Id$
 """
 
+from FilePData import FilePData
 from FolderItems import FolderItems
 from FolderItemsByKeychain import FolderItemsByKeychain
 from IdAttribute import IdAttribute