Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 31 additions & 32 deletions blobpatch
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
Index: Image.py
===================================================================
--- Image.py (revision 121465)
+++ Image.py (working copy)
@@ -49,6 +49,9 @@
diff --git src/OFS/Image.py src/OFS/Image.py
index f3d09ed..69eca18 100644
--- src/OFS/Image.py
+++ src/OFS/Image.py
@@ -48,6 +48,10 @@ from zope.event import notify
from zope.lifecycleevent import ObjectModifiedEvent
from zope.lifecycleevent import ObjectCreatedEvent

+from ZODB.interfaces import IBlobStorage
+from ZPublisher.Iterators import filestream_iterator
+import ZODB.blob
+
manage_addFileForm = DTMLFile('dtml/imageAdd',
globals(),
Kind='File',
@@ -251,33 +254,48 @@
@@ -250,32 +254,47 @@ class File(Persistent, Implicit, PropertyManager,
if isinstance(data, str):
RESPONSE.write(data[start:end])
return True
Expand Down Expand Up @@ -49,39 +50,38 @@ Index: Image.py
- if pos > start:
- # We are within the range
- lstart = l - (pos - start)
-
- if lstart < 0: lstart = 0
+ if lstart < 0: lstart = 0

- if lstart < 0: lstart = 0
- # find the endpoint
- if end <= pos:
- lend = l - (pos - end)
+ # find the endpoint
+ if end <= pos:
+ lend = l - (pos - end)

- # find the endpoint
- if end <= pos:
- lend = l - (pos - end)
- # Send and end transmission
- RESPONSE.write(data[lstart:lend])
- break
+ # Send and end transmission
+ RESPONSE.write(data[lstart:lend])
+ break

- # Send and end transmission
- RESPONSE.write(data[lstart:lend])
- break
- # Not yet at the end, transmit what we have.
- RESPONSE.write(data[lstart:])
+ # Not yet at the end, transmit what we have.
+ RESPONSE.write(data[lstart:])

- # Not yet at the end, transmit what we have.
- RESPONSE.write(data[lstart:])
- data = data.next
+ data = data.next

- data = data.next
- return True
+ return True

- return True
-
else:
boundary = choose_boundary()

@@ -322,6 +340,20 @@
@@ -321,6 +340,20 @@ class File(Persistent, Implicit, PropertyManager,
if isinstance(data, str):
RESPONSE.write(data[start:end])

Expand All @@ -102,7 +102,7 @@ Index: Image.py
else:
# Yippee. Linked Pdata objects. The following
# calculations allow us to fast-forward through the
@@ -364,7 +396,7 @@
@@ -363,7 +396,7 @@ class File(Persistent, Implicit, PropertyManager,

# Do not keep the link references around.
del pdata_map
Expand All @@ -111,7 +111,7 @@ Index: Image.py
RESPONSE.write('\r\n--%s--\r\n' % boundary)
return True

@@ -386,7 +418,7 @@
@@ -385,7 +418,7 @@ class File(Persistent, Implicit, PropertyManager,
# unfortunately.
self.ZCacheable_set(None)
return ''
Expand All @@ -120,7 +120,7 @@ Index: Image.py
if self.precondition and hasattr(self, str(self.precondition)):
# Grab whatever precondition was defined and then
# execute it. The precondition will raise an exception
@@ -396,11 +428,11 @@
@@ -395,11 +428,11 @@ class File(Persistent, Implicit, PropertyManager,
c(REQUEST['PARENTS'][1],REQUEST)
else:
c()
Expand All @@ -134,7 +134,7 @@ Index: Image.py
RESPONSE.setHeader('Last-Modified', rfc1123_date(self._p_mtime))
RESPONSE.setHeader('Content-Type', self.content_type)
RESPONSE.setHeader('Content-Length', self.size)
@@ -414,18 +446,23 @@
@@ -413,18 +446,23 @@ class File(Persistent, Implicit, PropertyManager,
# something implementing the IStreamIterator interface
# from a "FileCacheManager"
return result
Expand Down Expand Up @@ -166,7 +166,7 @@ Index: Image.py
return ''

security.declareProtected(View, 'view_image_or_file')
@@ -440,7 +477,7 @@
@@ -439,7 +477,7 @@ class File(Persistent, Implicit, PropertyManager,
""" Allow file objects to be searched.
"""
if self.content_type.startswith('text/'):
Expand All @@ -175,7 +175,7 @@ Index: Image.py
return ''

security.declarePrivate('update_data')
@@ -452,11 +489,23 @@
@@ -451,11 +489,23 @@ class File(Persistent, Implicit, PropertyManager,
if content_type is not None: self.content_type=content_type
if size is None: size=len(data)
self.size=size
Expand All @@ -200,7 +200,7 @@ Index: Image.py
security.declareProtected(change_images_and_files, 'manage_edit')
def manage_edit(self, title, content_type, precondition='',
filedata=None, REQUEST=None):
@@ -517,9 +566,15 @@
@@ -516,9 +566,15 @@ class File(Persistent, Implicit, PropertyManager,

n=1 << 16

Expand All @@ -217,7 +217,7 @@ Index: Image.py
# Big string: cut it into smaller chunks
file = StringIO(file)

@@ -536,15 +591,17 @@
@@ -535,14 +591,16 @@ class File(Persistent, Implicit, PropertyManager,
seek(0,2)
size=end=file.tell()

Expand All @@ -233,12 +233,11 @@ Index: Image.py
- # Make sure we have an _p_jar, even if we are a new object, by
- # doing a sub-transaction commit.
- transaction.savepoint(optimistic=True)

+

if self._p_jar is None:
# Ugh
seek(0)
@@ -621,7 +678,7 @@
@@ -620,7 +678,7 @@ class File(Persistent, Implicit, PropertyManager,
return self.content_type


Expand All @@ -247,7 +246,7 @@ Index: Image.py
def __len__(self): return 1

security.declareProtected(ftp_access, 'manage_FTPstat')
@@ -814,7 +871,13 @@
@@ -816,7 +874,13 @@ class Image(File):
if size is None: size=len(data)

self.size=size
Expand Down