Commit 2b1d8c47 authored by Tres Seaver's avatar Tres Seaver

Collector #1061: Clean up use of PData for large images

parent 2b9aff10
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Image object""" """Image object"""
__version__='$Revision: 1.100 $'[11:-2] __version__='$Revision: 1.101 $'[11:-2]
import Globals, string, struct, content_types import Globals, string, struct, content_types
from OFS.content_types import guess_content_type from OFS.content_types import guess_content_type
...@@ -285,7 +285,11 @@ class File(Persistent,Implicit,PropertyManager, ...@@ -285,7 +285,11 @@ class File(Persistent,Implicit,PropertyManager,
size=len(file) size=len(file)
if size < n: return file, size if size < n: return file, size
return Pdata(file), size return Pdata(file), size
if file.__class__ is Pdata:
size=len(file)
return file, size
seek=file.seek seek=file.seek
read=file.read read=file.read
...@@ -581,7 +585,8 @@ class Pdata(Persistent, Implicit): ...@@ -581,7 +585,8 @@ class Pdata(Persistent, Implicit):
return self.data[i:j] return self.data[i:j]
def __len__(self): def __len__(self):
return len(self.data) data = str(self)
return len(data)
def __str__(self): def __str__(self):
next=self.next next=self.next
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment