[merge] apply changes for lint fixes, webcal enable
bzr revid: xrg@hellug.gr-20100811084634-icdywns9g9kv3pfo
This commit is contained in:
@@ -71,8 +71,8 @@ class node_calendar_collection(nodes.node_dir):
|
||||
where = [('collection_id','=',self.dir_id)]
|
||||
ext = False
|
||||
if name and name.endswith('.ics'):
|
||||
name = name[-4]
|
||||
ext = '.ics'
|
||||
name = name[:-4]
|
||||
ext = True
|
||||
if name:
|
||||
where.append(('name','=',name))
|
||||
if not domain:
|
||||
@@ -81,11 +81,12 @@ class node_calendar_collection(nodes.node_dir):
|
||||
fil_obj = dirobj.pool.get('basic.calendar')
|
||||
ids = fil_obj.search(cr,uid,where,context=ctx)
|
||||
res = []
|
||||
for calender in fil_obj.browse(cr, uid, ids, context=ctx):
|
||||
if not ext:
|
||||
res.append(node_calendar(calender.name, self, self.context, calender))
|
||||
else:
|
||||
res.append(res_node_calendar(name, self, self.context, calender))
|
||||
for cal in fil_obj.browse(cr, uid, ids, context=ctx):
|
||||
if (not name) or not ext:
|
||||
res.append(node_calendar(cal.name, self, self.context, cal))
|
||||
if (not name) or ext:
|
||||
res.append(res_node_calendar(cal.name+'.ics', self, self.context, cal))
|
||||
# May be both of them!
|
||||
return res
|
||||
|
||||
def _get_dav_owner(self, cr):
|
||||
|
||||
@@ -18,16 +18,13 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import base64
|
||||
|
||||
from osv import osv, fields
|
||||
from osv.orm import except_orm
|
||||
import urlparse
|
||||
|
||||
import netsvc
|
||||
import os
|
||||
# import os
|
||||
import nodes
|
||||
import StringIO
|
||||
# import StringIO
|
||||
|
||||
class document_directory_content_type(osv.osv):
|
||||
_name = 'document.directory.content.type'
|
||||
@@ -83,7 +80,7 @@ class document_directory_content(osv.osv):
|
||||
tname = ''
|
||||
if content.include_name:
|
||||
content_name = node.displayname or ''
|
||||
obj = node.context._dirobj.pool.get(model)
|
||||
# obj = node.context._dirobj.pool.get(model)
|
||||
if content_name:
|
||||
tname = (content.prefix or '') + content_name + (content.suffix or '') + (content.extension or '')
|
||||
else:
|
||||
|
||||
@@ -20,13 +20,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import base64
|
||||
|
||||
from osv import osv, fields
|
||||
from osv.orm import except_orm
|
||||
import urlparse
|
||||
|
||||
import os
|
||||
|
||||
class ir_action_report_xml(osv.osv):
|
||||
_name="ir.actions.report.xml"
|
||||
|
||||
@@ -22,16 +22,10 @@
|
||||
import base64
|
||||
|
||||
from osv import osv, fields
|
||||
import urlparse
|
||||
|
||||
import os
|
||||
|
||||
import pooler
|
||||
import netsvc
|
||||
from osv.orm import except_orm
|
||||
#import StringIO
|
||||
|
||||
from psycopg2 import Binary
|
||||
# from psycopg2 import Binary
|
||||
#from tools import config
|
||||
import tools
|
||||
from tools.translate import _
|
||||
|
||||
@@ -19,11 +19,8 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import base64
|
||||
|
||||
from osv import osv, fields
|
||||
from osv.orm import except_orm
|
||||
import urlparse
|
||||
|
||||
import os
|
||||
import nodes
|
||||
@@ -141,30 +138,6 @@ class document_directory(osv.osv):
|
||||
_parent(dir_id, path)
|
||||
return path
|
||||
|
||||
def ol_get_resource_path(self, cr, uid, dir_id, res_model, res_id):
|
||||
# this method will be used in process module
|
||||
# to be need test and Improvement if resource dir has parent resource (link resource)
|
||||
path=[]
|
||||
def _parent(dir_id,path):
|
||||
parent=self.browse(cr, uid, dir_id)
|
||||
if parent.parent_id and not parent.ressource_parent_type_id:
|
||||
_parent(parent.parent_id.id,path)
|
||||
path.append(parent.name)
|
||||
else:
|
||||
path.append(parent.name)
|
||||
return path
|
||||
|
||||
directory=self.browse(cr,uid,dir_id)
|
||||
model_ids=self.pool.get('ir.model').search(cr, uid, [('model','=',res_model)])
|
||||
if directory:
|
||||
_parent(dir_id,path)
|
||||
path.append(self.pool.get(directory.ressource_type_id.model).browse(cr, uid, res_id).name)
|
||||
#user=self.pool.get('res.users').browse(cr,uid,uid)
|
||||
#return "ftp://%s:%s@localhost:%s/%s/%s"%(user.login,user.password,config.get('ftp_server_port',8021),cr.dbname,'/'.join(path))
|
||||
# No way we will return the password!
|
||||
return "ftp://user:pass@host:port/test/this"
|
||||
return False
|
||||
|
||||
def _check_recursion(self, cr, uid, ids):
|
||||
level = 100
|
||||
while len(ids):
|
||||
@@ -178,8 +151,9 @@ class document_directory(osv.osv):
|
||||
_constraints = [
|
||||
(_check_recursion, 'Error! You can not create recursive Directories.', ['parent_id'])
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
res = super(document_directory, self).__init__(*args, **kwargs)
|
||||
super(document_directory, self).__init__(*args, **kwargs)
|
||||
#self._cache = {}
|
||||
|
||||
def onchange_content_id(self, cr, uid, ids, ressource_type_id):
|
||||
@@ -223,31 +197,8 @@ class document_directory(osv.osv):
|
||||
""" try to locate the node in uri,
|
||||
Return a tuple (node_dir, remaining_path)
|
||||
"""
|
||||
return (nodes.node_database(context=ncontext), uri)
|
||||
return (nodes.node_database(context=ncontext), uri)
|
||||
|
||||
def old_code():
|
||||
if not uri:
|
||||
return node_database(cr, uid, context=context)
|
||||
turi = tuple(uri)
|
||||
node = node_class(cr, uid, '/', False, context=context, type='database')
|
||||
for path in uri[:]:
|
||||
if path:
|
||||
node = node.child(path)
|
||||
if not node:
|
||||
return False
|
||||
oo = node.object and (node.object._name, node.object.id) or False
|
||||
oo2 = node.object2 and (node.object2._name, node.object2.id) or False
|
||||
return node
|
||||
|
||||
def ol_get_childs(self, cr, uid, uri, context={}):
|
||||
node = self.get_object(cr, uid, uri, context)
|
||||
if uri:
|
||||
children = node.children()
|
||||
else:
|
||||
children= [node]
|
||||
result = map(lambda node: node.path_get(), children)
|
||||
return result
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if not default:
|
||||
default ={}
|
||||
|
||||
@@ -37,7 +37,6 @@ from osv.orm import except_orm
|
||||
import random
|
||||
import string
|
||||
import pooler
|
||||
import netsvc
|
||||
import nodes
|
||||
from content_index import cntIndex
|
||||
|
||||
@@ -189,7 +188,7 @@ class nodefd_db(StringIO, nodes.node_descriptor):
|
||||
# we now open a *separate* cursor, to update the data.
|
||||
# FIXME: this may be improved, for concurrency handling
|
||||
par = self._get_parent()
|
||||
uid = par.context.uid
|
||||
# uid = par.context.uid
|
||||
cr = pooler.get_db(par.context.dbname).cursor()
|
||||
try:
|
||||
if self.mode in ('w', 'w+', 'r+'):
|
||||
@@ -227,7 +226,7 @@ class nodefd_db(StringIO, nodes.node_descriptor):
|
||||
" WHERE id = %s",
|
||||
(out, len(data), par.file_id))
|
||||
cr.commit()
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
logging.getLogger('document.storage').exception('Cannot update db file #%d for close:', par.file_id)
|
||||
raise
|
||||
finally:
|
||||
@@ -262,7 +261,7 @@ class nodefd_db64(StringIO, nodes.node_descriptor):
|
||||
# we now open a *separate* cursor, to update the data.
|
||||
# FIXME: this may be improved, for concurrency handling
|
||||
par = self._get_parent()
|
||||
uid = par.context.uid
|
||||
# uid = par.context.uid
|
||||
cr = pooler.get_db(par.context.dbname).cursor()
|
||||
try:
|
||||
if self.mode in ('w', 'w+', 'r+'):
|
||||
@@ -288,18 +287,18 @@ class nodefd_db64(StringIO, nodes.node_descriptor):
|
||||
cr.execute('UPDATE ir_attachment SET db_datas = %s::bytea, file_size=%s, ' \
|
||||
'index_content = %s, file_type = %s ' \
|
||||
'WHERE id = %s',
|
||||
(base64.encodestring(out), len(out), icont_u, mime, par.file_id))
|
||||
(base64.encodestring(data), len(data), icont_u, mime, par.file_id))
|
||||
elif self.mode == 'a':
|
||||
out = self.getvalue()
|
||||
data = self.getvalue()
|
||||
# Yes, we're obviously using the wrong representation for storing our
|
||||
# data as base64-in-bytea
|
||||
cr.execute("UPDATE ir_attachment " \
|
||||
"SET db_datas = encode( (COALESCE(decode(encode(db_datas,'escape'),'base64'),'') || decode(%s, 'base64')),'base64')::bytea , " \
|
||||
" file_size = COALESCE(file_size, 0) + %s " \
|
||||
" WHERE id = %s",
|
||||
(base64.encodestring(out), len(out), par.file_id))
|
||||
(base64.encodestring(data), len(data), par.file_id))
|
||||
cr.commit()
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
logging.getLogger('document.storage').exception('Cannot update db file #%d for close:', par.file_id)
|
||||
raise
|
||||
finally:
|
||||
@@ -500,7 +499,7 @@ class document_storage(osv.osv):
|
||||
# try to fix their directory.
|
||||
if ira.file_size:
|
||||
self._doclog.warning("ir.attachment #%d does not have a filename, trying the name." %ira.id)
|
||||
sfname = ira.name
|
||||
# sfname = ira.name
|
||||
fpath = os.path.join(boo.path,ira.store_fname or ira.name)
|
||||
if os.path.exists(fpath):
|
||||
return file(fpath,'rb').read()
|
||||
@@ -695,7 +694,7 @@ class document_storage(osv.osv):
|
||||
store_fname = os.path.join(*store_path)
|
||||
return { 'name': new_name, 'datas_fname': new_name, 'store_fname': store_fname }
|
||||
else:
|
||||
raise TypeError("No %s storage" % boo.type)
|
||||
raise TypeError("No %s storage" % sbro.type)
|
||||
|
||||
def simple_move(self, cr, uid, file_node, ndir_bro, context=None):
|
||||
""" A preparation for a file move.
|
||||
@@ -734,7 +733,7 @@ class document_storage(osv.osv):
|
||||
fname = fil_bo.store_fname
|
||||
if not fname:
|
||||
return ValueError("Tried to rename a non-stored file")
|
||||
path = storage_bo.path
|
||||
path = sbro.path
|
||||
oldpath = os.path.join(path, fname)
|
||||
|
||||
for ch in ('*', '|', "\\", '/', ':', '"', '<', '>', '?', '..'):
|
||||
@@ -751,7 +750,7 @@ class document_storage(osv.osv):
|
||||
os.rename(oldpath, newpath)
|
||||
return { 'name': new_name, 'datas_fname': new_name, 'store_fname': new_name }
|
||||
else:
|
||||
raise TypeError("No %s storage" % boo.type)
|
||||
raise TypeError("No %s storage" % sbro.type)
|
||||
|
||||
|
||||
document_storage()
|
||||
|
||||
@@ -19,17 +19,14 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# import base64
|
||||
# import StringIO
|
||||
from osv import osv, fields
|
||||
from osv.orm import except_orm
|
||||
# import urlparse
|
||||
import pooler
|
||||
from tools.safe_eval import safe_eval
|
||||
|
||||
import errno
|
||||
import os
|
||||
# import os
|
||||
import time
|
||||
import logging
|
||||
|
||||
from StringIO import StringIO
|
||||
|
||||
@@ -44,6 +41,8 @@ from StringIO import StringIO
|
||||
# root: if we are at the first directory of a ressource
|
||||
#
|
||||
|
||||
logger = logging.getLogger('doc2.nodes')
|
||||
|
||||
def _str2time(cre):
|
||||
""" Convert a string with time representation (from db) into time (float)
|
||||
|
||||
@@ -902,9 +901,8 @@ class node_res_obj(node_class):
|
||||
|
||||
def get_dav_eprop(self, cr, ns, prop):
|
||||
if ns != 'http://groupdav.org/' or prop != 'resourcetype':
|
||||
print "Who asked for %s:%s?" % (ns, prop)
|
||||
logger.warning("Who asked for %s:%s?" % (ns, prop))
|
||||
return None
|
||||
res = {}
|
||||
cntobj = self.context._dirobj.pool.get('document.directory.content')
|
||||
uid = self.context.uid
|
||||
ctx = self.context.context.copy()
|
||||
@@ -1374,11 +1372,11 @@ class nodefd_content(StringIO, node_descriptor):
|
||||
if self.mode in ('w', 'w+', 'r+'):
|
||||
data = self.getvalue()
|
||||
cntobj = par.context._dirobj.pool.get('document.directory.content')
|
||||
cntobj.process_write(cr, uid, parent, data, ctx)
|
||||
cntobj.process_write(cr, uid, par, data, par.context.context)
|
||||
elif self.mode == 'a':
|
||||
raise NotImplementedError
|
||||
cr.commit()
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
logging.getLogger('document.content').exception('Cannot update db content #%d for close:', par.cnt_id)
|
||||
raise
|
||||
finally:
|
||||
|
||||
@@ -35,7 +35,7 @@ for fname in args:
|
||||
for line in res[:5]:
|
||||
print line
|
||||
except Exception,e:
|
||||
import traceback,sys
|
||||
import traceback
|
||||
tb_s = reduce(lambda x, y: x+y, traceback.format_exception( sys.exc_type, sys.exc_value, sys.exc_traceback))
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import time
|
||||
from tarfile import filemode
|
||||
import StringIO
|
||||
import base64
|
||||
import logging
|
||||
import errno
|
||||
|
||||
@@ -12,12 +11,11 @@ import fnmatch
|
||||
|
||||
import pooler
|
||||
import netsvc
|
||||
import os
|
||||
|
||||
from service import security
|
||||
from osv import osv
|
||||
#from document.nodes import node_res_dir, node_res_obj
|
||||
from document.nodes import get_node_context
|
||||
import stat
|
||||
|
||||
def _get_month_name(month):
|
||||
month=int(month)
|
||||
@@ -165,7 +163,7 @@ class abstracted_fs(object):
|
||||
return ret
|
||||
except EnvironmentError:
|
||||
raise
|
||||
except Exception,e:
|
||||
except Exception:
|
||||
self._log.exception('Cannot create item %s at node %s', objname, repr(node))
|
||||
raise OSError(1, 'Operation not permited.')
|
||||
|
||||
@@ -177,7 +175,7 @@ class abstracted_fs(object):
|
||||
try:
|
||||
res = node.open_data(cr, mode)
|
||||
cr.commit()
|
||||
except TypeError, e:
|
||||
except TypeError:
|
||||
raise IOError(errno.EINVAL, "No data")
|
||||
return res
|
||||
|
||||
@@ -188,12 +186,11 @@ class abstracted_fs(object):
|
||||
name. Unlike mkstemp it returns an object with a file-like
|
||||
interface.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
raise NotImplementedError # TODO
|
||||
|
||||
text = not 'b' in mode
|
||||
# for unique file , maintain version if duplicate file
|
||||
if dir:
|
||||
# TODO
|
||||
cr = dir.cr
|
||||
uid = dir.uid
|
||||
pool = pooler.get_pool(node.context.dbname)
|
||||
@@ -234,7 +231,7 @@ class abstracted_fs(object):
|
||||
cdir = node.create_child_collection(cr, basename)
|
||||
self._log.debug("Created child dir: %r", cdir)
|
||||
cr.commit()
|
||||
except Exception,e:
|
||||
except Exception:
|
||||
self._log.exception('Cannot create dir "%s" at node %s', basename, repr(node))
|
||||
raise OSError(1, 'Operation not permited.')
|
||||
|
||||
@@ -405,7 +402,7 @@ class abstracted_fs(object):
|
||||
cr.commit()
|
||||
except EnvironmentError:
|
||||
raise
|
||||
except Exception, err:
|
||||
except Exception:
|
||||
self._log.exception('Cannot rename "%s" to "%s" at "%s"', src, datacr[2], datacr[1])
|
||||
raise OSError(1,'Operation not permited.')
|
||||
|
||||
|
||||
@@ -121,15 +121,9 @@ import tempfile
|
||||
import warnings
|
||||
import random
|
||||
import stat
|
||||
from collections import deque
|
||||
from tarfile import filemode
|
||||
|
||||
try:
|
||||
import pwd
|
||||
import grp
|
||||
except ImportError:
|
||||
pwd = grp = None
|
||||
|
||||
|
||||
LOG_ACTIVE = True
|
||||
|
||||
__all__ = ['proto_cmds', 'Error', 'log', 'logline', 'logerror', 'DummyAuthorizer',
|
||||
@@ -192,24 +186,6 @@ proto_cmds = {
|
||||
}
|
||||
|
||||
|
||||
# hack around format_exc function of traceback module to grant
|
||||
# backward compatibility with python < 2.4
|
||||
if not hasattr(traceback, 'format_exc'):
|
||||
try:
|
||||
import cStringIO as StringIO
|
||||
except ImportError:
|
||||
import StringIO
|
||||
|
||||
def _format_exc():
|
||||
f = StringIO.StringIO()
|
||||
traceback.print_exc(file=f)
|
||||
data = f.getvalue()
|
||||
f.close()
|
||||
return data
|
||||
|
||||
traceback.format_exc = _format_exc
|
||||
|
||||
|
||||
def _strerror(err):
|
||||
"""A wrap around os.strerror() which may be not available on all
|
||||
platforms (e.g. pythonCE).
|
||||
@@ -590,16 +566,6 @@ class ActiveDTP(asyncore.dispatcher):
|
||||
self.cmd_channel.respond("425 Can't connect to specified address.")
|
||||
self.close()
|
||||
|
||||
|
||||
try:
|
||||
from collections import deque
|
||||
except ImportError:
|
||||
# backward compatibility with Python < 2.4 by replacing deque with a list
|
||||
class deque(list):
|
||||
def appendleft(self, obj):
|
||||
list.insert(self, 0, obj)
|
||||
|
||||
|
||||
class DTPHandler(asyncore.dispatcher):
|
||||
"""Class handling server-data-transfer-process (server-DTP, see
|
||||
RFC-959) managing data-transfer operations involving sending
|
||||
@@ -1227,21 +1193,9 @@ class AbstractedFS:
|
||||
if not nlinks: # non-posix system, let's use a bogus value
|
||||
nlinks = 1
|
||||
size = st.st_size # file size
|
||||
if pwd and grp:
|
||||
# get user and group name, else just use the raw uid/gid
|
||||
try:
|
||||
uname = pwd.getpwuid(st.st_uid).pw_name
|
||||
except KeyError:
|
||||
uname = st.st_uid
|
||||
try:
|
||||
gname = grp.getgrgid(st.st_gid).gr_name
|
||||
except KeyError:
|
||||
gname = st.st_gid
|
||||
else:
|
||||
# on non-posix systems the only chance we use default
|
||||
# bogus values for owner and group
|
||||
uname = "owner"
|
||||
gname = "group"
|
||||
uname = st.st_uid or "owner"
|
||||
gname = st.st_gid or "group"
|
||||
|
||||
# stat.st_mtime could fail (-1) if last mtime is too old
|
||||
# in which case we return the local time as last mtime
|
||||
try:
|
||||
@@ -1438,7 +1392,7 @@ class FTPHandler(asynchat.async_chat):
|
||||
"""
|
||||
try:
|
||||
asynchat.async_chat.__init__(self, conn=conn) # python2.5
|
||||
except TypeError, e:
|
||||
except TypeError:
|
||||
asynchat.async_chat.__init__(self, sock=conn) # python2.6
|
||||
self.server = server
|
||||
self.remote_ip, self.remote_port = self.socket.getpeername()[:2]
|
||||
@@ -1469,13 +1423,10 @@ class FTPHandler(asynchat.async_chat):
|
||||
|
||||
# mlsx facts attributes
|
||||
self.current_facts = ['type', 'perm', 'size', 'modify']
|
||||
if os.name == 'posix':
|
||||
self.current_facts.append('unique')
|
||||
self.current_facts.append('unique')
|
||||
self.available_facts = self.current_facts[:]
|
||||
if pwd and grp:
|
||||
self.available_facts += ['unix.mode', 'unix.uid', 'unix.gid']
|
||||
if os.name == 'nt':
|
||||
self.available_facts.append('create')
|
||||
self.available_facts += ['unix.mode', 'unix.uid', 'unix.gid']
|
||||
self.available_facts.append('create')
|
||||
|
||||
# dtp attributes
|
||||
self.data_server = None
|
||||
@@ -1866,7 +1817,7 @@ class FTPHandler(asynchat.async_chat):
|
||||
self.respond('%s %s.' % (str(ret_code), why))
|
||||
|
||||
raise FTPExceptionSent(why)
|
||||
except Exception, e:
|
||||
except Exception, err:
|
||||
cmdname = function.__name__
|
||||
try:
|
||||
logerror(traceback.format_exc())
|
||||
@@ -2003,7 +1954,7 @@ class FTPHandler(asynchat.async_chat):
|
||||
assert len(octs) == 4
|
||||
for x in octs:
|
||||
assert 0 <= x <= 255
|
||||
except (AssertionError, ValueError, OverflowError), err:
|
||||
except (AssertionError, ValueError, OverflowError):
|
||||
self.respond("501 Invalid EPRT format.")
|
||||
else:
|
||||
self._make_eport(ip, port)
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
# from tools.translate import _
|
||||
from document_ftp import ftpserver
|
||||
|
||||
class document_ftp_browse(osv.osv_memory):
|
||||
_name = 'document.ftp.browse'
|
||||
_description = 'Document FTP Browse'
|
||||
@@ -35,8 +36,8 @@ class document_ftp_browse(osv.osv_memory):
|
||||
if 'url' in fields:
|
||||
user_pool = self.pool.get('res.users')
|
||||
current_user = user_pool.browse(cr, uid, uid, context=context)
|
||||
dir_pool = self.pool.get('document.directory')
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
# dir_pool = self.pool.get('document.directory')
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
aid = data_pool._get_id(cr, uid, 'document_ftp', 'action_document_browse')
|
||||
aid = data_pool.browse(cr, uid, aid, context=context).res_id
|
||||
ftp_url = self.pool.get('ir.actions.url').browse(cr, uid, aid, context=context)
|
||||
@@ -50,12 +51,12 @@ class document_ftp_browse(osv.osv_memory):
|
||||
|
||||
def browse_ftp(self, cr, uid, ids, context):
|
||||
data_id = ids and ids[0] or False
|
||||
data = self.browse(cr, uid, data_id, context)
|
||||
data = self.browse(cr, uid, data_id, context)
|
||||
final_url = data.url
|
||||
return {
|
||||
'type': 'ir.actions.act_url',
|
||||
'url':final_url,
|
||||
'target': 'new'
|
||||
}
|
||||
|
||||
document_ftp_browse()
|
||||
|
||||
|
||||
@@ -19,14 +19,8 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import base64
|
||||
|
||||
from osv import osv, fields
|
||||
from osv.orm import except_orm
|
||||
from tools import config
|
||||
import urlparse
|
||||
|
||||
import os
|
||||
|
||||
class document_ftp_configuration(osv.osv_memory):
|
||||
|
||||
@@ -46,10 +40,10 @@ class document_ftp_configuration(osv.osv_memory):
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
conf = self.browse(cr, uid, ids[0], context)
|
||||
dir_pool = self.pool.get('document.directory')
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
# Update the action for FTP browse.
|
||||
aid = data_pool._get_id(cr, uid, 'document_ftp', 'action_document_browse')
|
||||
aid = data_pool.browse(cr, uid, aid, context=context).res_id
|
||||
self.pool.get('ir.actions.url').write(cr, uid, [aid], {'url': 'ftp://'+(conf.host or 'localhost:8021')+'/'})
|
||||
|
||||
document_ftp_configuration()
|
||||
|
||||
Reference in New Issue
Block a user