Hi,
sorry for the delay, but I was almost 3 weeks without access to my
computer...
In case someone is interested, this is what I did to get zope.fle to work
with Blobs... like I said: it seems to work ok, but deleting a file
leaves the blob object lying on the filesystem (even after packing the
DB) -- oh, and I still haven't figured out how to make the security
declarations for the file handle, so for the test I just skipped security
altogether:
1) Modify the externals to use the BLOB-branch of ZODB:
2) put zope.file and zope.mimetypes in my instance, and replace the stringio
in zope.file with a Blob
regards. luis
patch 1: Zope3/file_blob_Zope3.patch:
Property changes on: src
___
Name: svn:externals
- docutils svn://svn.zope.org/repos/main/docutils/tags/0.4.0
ZConfig svn://svn.zope.org/repos/main/ZConfig/trunk/ZConfig
BTrees -r 69196
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/BTrees
persistent -r 69196
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/persistent
ThreadedAsync -r 69196
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ThreadedAsync
transaction -r 69196
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/transaction
ZEO -r 69196
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZEO
ZODB -r 69196
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZODB
twisted -r 15340
svn://svn.twistedmatrix.com/svn/Twisted/branches/releases/2.1.x/twisted
zdaemon -r 40792
svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon
+ docutils svn://svn.zope.org/repos/main/docutils/tags/0.4.0
ZConfig svn://svn.zope.org/repos/main/ZConfig/trunk/ZConfig
BTrees -r 69196
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/BTrees
persistent -r 69196
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/persistent
ThreadedAsync -r 69196
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ThreadedAsync
transaction -r 69196
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/transaction
ZEO -r 69196
svn://svn.zope.org/repos/main/ZODB/branches/3.7/src/ZEO
ZODB
svn://svn.zope.org/repos/main/ZODB/tags/blob-technical-preview/src/ZODB
twisted -r 15340
svn://svn.twistedmatrix.com/svn/Twisted/branches/releases/2.1.x/twisted
zdaemon -r 40792
svn://svn.zope.org/repos/main/zdaemon/trunk/src/zdaemon
Index: zope.conf.in
===
--- zope.conf.in(revision 69370)
+++ zope.conf.in(working copy)
@@ -46,10 +46,20 @@
# /sshserver
# Standard Filestorage
+#zodb
+# filestorage
+# path Data.fs
+# /filestorage
+#/zodb
+
+# Filestorge with Blob support
zodb
- filestorage
- path Data.fs
- /filestorage
+ blobstorage
+ blob-dir blobs
+ filestorage
+ path Data.fs
+ /filestorage
+ /blobstorage
/zodb
accesslog
patch 2 : Zope3/src/zope/file/file_blob.patch
Index: configure.zcml
===
--- configure.zcml (revision 69216)
+++ configure.zcml (working copy)
@@ -27,6 +27,7 @@
!-- set up permissions for the accessor objects --
+!-- FIXME: Do we still need this ?
class class=.file.Reader
require
permission=zope.View
@@ -44,7 +45,14 @@
attributes=close flush write
/
/class
-
+ *** / FIXME --
+
+ !-- this is not working.. :-( --
+ class class=file
+ allow attributes=read /
+ require
+ permission=zope.View attributes=write writelines truncate /
+ /class
!-- Subscriber to update the mimeType field on content-type
changes. --
subscriber
Index: download.py
===
--- download.py (revision 69216)
+++ download.py (working copy)
@@ -23,6 +23,10 @@
import zope.publisher.http
+#FIXME: this is bad.. but I haven't found a way to make security
declarations
on the file handle object (inheriting from a normal python file object)..
so for this test we just turn off security all together =(
+from zope.security.proxy import removeSecurityProxy
+
+
class Download(object):
zope.interface.implements(
@@ -87,7 +91,9 @@
# application/database; ZODB BLOBs will provide a equivalent
# feature once available.
#
- data = context.open(rb).read()
+ file = context.open(rb)
+ file = removeSecurityProxy(file) #FIXME
+ data = file.read()
self.headers += (Content-Length, str(context.size)),
self.body = bodyIterator(cStringIO.StringIO(data))
Index: file.py
===
--- file.py (revision 69216)
+++ file.py (working copy)
@@ -15,8 +15,13 @@
__docformat__ = reStructuredText
-import cStringIO
+#import os
+#import stat
+from ZODB.Blobs.Blob import Blob