Document API: implement the node_file.open_data()

bzr revid: p_christ@hol.gr-20100629140525-a54b2p51b8co2zsf
This commit is contained in:
P. Christeas 2010-06-29 17:05:25 +03:00
parent 2406e4a93d
commit 075affaccc
1 changed files with 10 additions and 5 deletions

View File

@ -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