summaryrefslogtreecommitdiff
path: root/addons/document/document_storage.py
diff options
context:
space:
mode:
authorP. Christeas <p_christ@hol.gr>2010-11-03 13:26:05 +0200
committerP. Christeas <p_christ@hol.gr>2010-11-03 13:26:05 +0200
commita21dcd7e1c8623f4aaf3a3659e81247273f652e9 (patch)
tree9361ea73162f00c1656b781fc2b8cbe2265251d0 /addons/document/document_storage.py
parent4959480bc1518d0c9bf838c8dcd700dd36e40eb8 (diff)
document: fix regressions at storage and node_descriptor
Since the introduction of __len__, the descriptors were broken for the ftp module. Fix. bzr revid: p_christ@hol.gr-20101103112605-tu6n6529mbdc18ve
Diffstat (limited to 'addons/document/document_storage.py')
-rw-r--r--addons/document/document_storage.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/document/document_storage.py b/addons/document/document_storage.py
index 64b8b067bae..513da92bfcd 100644
--- a/addons/document/document_storage.py
+++ b/addons/document/document_storage.py
@@ -181,7 +181,8 @@ class nodefd_db(StringIO, nodes.node_descriptor):
cr = ira_browse._cr # reuse the cursor of the browse object, just now
cr.execute('SELECT db_datas FROM ir_attachment WHERE id = %s',(ira_browse.id,))
data = cr.fetchone()[0]
- self._size = len(data)
+ if data:
+ self._size = len(data)
StringIO.__init__(self, data)
elif mode in ('w', 'w+'):
StringIO.__init__(self, None)
@@ -260,7 +261,8 @@ class nodefd_db64(StringIO, nodes.node_descriptor):
if mode in ('r', 'r+'):
data = base64.decodestring(ira_browse.db_datas)
- self._size = len(data)
+ if data:
+ self._size = len(data)
StringIO.__init__(self, data)
elif mode in ('w', 'w+'):
StringIO.__init__(self, None)