Document: fix creating of empty files.
authorP. Christeas <p_christ@hol.gr>
Wed, 23 Jun 2010 14:07:09 +0000 (17:07 +0300)
committerP. Christeas <p_christ@hol.gr>
Wed, 23 Jun 2010 14:07:09 +0000 (17:07 +0300)
For an empty file, the interface (eg. webdav) could ask to create with
data=None. Allow that.

bzr revid: p_christ@hol.gr-20100623140709-m11r40kk2dl9okvo

addons/document/nodes.py

index df1878a..299e2a8 100644 (file)
@@ -339,7 +339,8 @@ class node_dir(node_database):
         fil_id = fil_obj.create(cr, uid, val, context=ctx)
         fil = fil_obj.browse(cr, uid, fil_id, context=ctx)
         fnode = node_file(path, self, self.context, fil)
-        fnode.set_data(cr, data, fil)
+        if data is not None:
+            fnode.set_data(cr, data, fil)
         return fnode
 
     def get_etag(self, cr):