diff options
| author | P. Christeas <p_christ@hol.gr> | 2010-06-29 17:05:25 +0300 |
|---|---|---|
| committer | P. Christeas <p_christ@hol.gr> | 2010-06-29 17:05:25 +0300 |
| commit | 075affaccccd021dd14bc2c4b7a08f3dbf7a8fa7 (patch) | |
| tree | 388d10eb56fb5e682ee8e58e1afbf7f9b9e8edfa | |
| parent | 2406e4a93d0654995bd89f44f28a4bac039a0a70 (diff) | |
Document API: implement the node_file.open_data()
bzr revid: p_christ@hol.gr-20100629140525-a54b2p51b8co2zsf
| -rw-r--r-- | addons/document/nodes.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/addons/document/nodes.py b/addons/document/nodes.py index d78fdc8af92..75db03a2c1a 100644 --- a/addons/document/nodes.py +++ b/addons/document/nodes.py @@ -19,11 +19,11 @@ # ############################################################################## -import base64 -import StringIO +# import base64 +# import StringIO from osv import osv, fields from osv.orm import except_orm -import urlparse +# import urlparse import pooler from tools.safe_eval import safe_eval @@ -741,8 +741,13 @@ class node_file(node_class): par = par.parent_id - def open(self, cr, mode=False): - raise DeprecationWarning("Who called this?") + def open_data(self, cr, mode): + stor = self.storage_id + assert stor, "No storage for file #%s" % self.file_id + # If storage is not set properly, we are just screwed here, don't + # try to get it from default. + stobj = self.context._dirobj.pool.get('document.storage') + return stobj.get_file(cr, self.context.uid, stor, self, mode=mode, context=self.context.context) def rm(self, cr): uid = self.context.uid |
