Skip to content

This is a monkey patch for zope 2.13 to add blob support for OFS.Image and File

License

Notifications You must be signed in to change notification settings

Immudzen/MonkeyOFSImageFile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a small monkey patch to add blob support to OFS.Image and File

This adds a new method called resave_to_blob that can be called on any Image
or File to save them as a blob to the filesystem instead.

This is my suggested upgrade script. It will convert all File and Image objects

for id, obj in container.ZopeFind(container, obj_metatypes=['File', 'Image'], search_sub=1):
    resave_to_blob = getattr(obj, 'resave_to_blob', None)
    if resave_to_blob is not None:
        resave_to_blob()
return 'Done'


If you have a large database or a system where the above script could cause a timeout that would
cause problems I have created a script that you can run from zopectl

bin/zopectl run /path/to/upgrade_blob.py

The upgrade_blob.py file is part of the included files

The only requirements I know of is having zope 2.13 installed and working and blob support setup.
This patch should work on zope 2.12 also but I don't know for sure.

example zope.conf db section for blobs

<zodb_db main>
    mount-point /
    cache-size 5000
    <zeoclient>
      blob-dir /var/lib/zope2.12/blobs
      shared-blob-dir true

      server /var/lib/zope2.12/zeo/main/main.soc
      storage 1
      name main
      var $INSTANCE/var
      cache-size 0 
    </zeoclient>
  </zodb_db>


example zeo.conf db section for blobs

<blobstorage 1>
<filestorage>
  path $INSTANCE/var/Data.fs
</filestorage>
blob-dir /var/lib/zope2.12/blobs
</blobstorage>


A pure zope example I don't have right now.

The above setup with zeo makes it so that zope and zeo will share the same blob dir so that blobs
are not sent over zeo.

About

This is a monkey patch for zope 2.13 to add blob support for OFS.Image and File

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages