diff --git a/addons/document_webdav/__init__.py b/addons/document_webdav/__init__.py index 11bbd35f7c3..3dc4c104c80 100644 --- a/addons/document_webdav/__init__.py +++ b/addons/document_webdav/__init__.py @@ -20,13 +20,9 @@ ############################################################################## import logging -_logger = logging.getLogger(__name__) +import webdav +import webdav_server +import document_webdav -try: - import webdav - import webdav_server - import document_webdav -except ImportError: - _logger.info('document_webdav disabled please install PyWebDAV from http://code.google.com/p/pywebdav/downloads/detail?name=PyWebDAV-0.9.4.tar.gz&can=2&q=/') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/document_webdav/dav_fs.py b/addons/document_webdav/dav_fs.py index 1b826434f74..5b3e4272042 100644 --- a/addons/document_webdav/dav_fs.py +++ b/addons/document_webdav/dav_fs.py @@ -24,16 +24,24 @@ import sql_db import os import time import errno +import re +import openerp import netsvc import urlparse +try: + from pywebdav.lib.constants import COLLECTION # , OBJECT + from pywebdav.lib.errors import DAV_Error, DAV_Forbidden, DAV_NotFound + from pywebdav.lib.iface import dav_interface + from pywebdav.lib.davcmd import copyone, copytree, moveone, movetree, delone, deltree +except ImportError: + from DAV.constants import COLLECTION #, OBJECT + from DAV.errors import DAV_Error, DAV_Forbidden, DAV_NotFound + from DAV.iface import dav_interface + from DAV.davcmd import copyone, copytree, moveone, movetree, delone, deltree -from DAV.constants import COLLECTION #, OBJECT -from DAV.errors import DAV_Error, DAV_Forbidden, DAV_NotFound -from DAV.iface import dav_interface import urllib -from DAV.davcmd import copyone, copytree, moveone, movetree, delone, deltree from cache import memoize from tools import misc @@ -355,7 +363,8 @@ class openerp_dav_handler(dav_interface): return self.parent.get_baseuri(self) + '/'.join(ajoin) @memoize(4) - def db_list(self): + def _all_db_list(self): + """return all databases who have module document_webdav installed""" s = netsvc.ExportService.getService('db') result = s.exp_list() self.db_name_list=[] @@ -364,7 +373,7 @@ class openerp_dav_handler(dav_interface): try: db = sql_db.db_connect(db_name) cr = db.cursor() - cr.execute("SELECT id FROM ir_module_module WHERE name = 'document' AND state='installed' ") + cr.execute("SELECT id FROM ir_module_module WHERE name = 'document_webdav' AND state='installed' ") res=cr.fetchone() if res and len(res): self.db_name_list.append(db_name) @@ -375,6 +384,15 @@ class openerp_dav_handler(dav_interface): cr.close() return self.db_name_list + def db_list(self, uri): + # import pudb;pudb.set_trace() + u = urlparse.urlsplit(uri) + h = u.hostname + d = h.split('.')[0] + r = openerp.tools.config['dbfilter'].replace('%h', h).replace('%d',d) + dbs = [i for i in self._all_db_list() if re.match(r, i)] + return dbs + def get_childs(self,uri, filters=None): """ return the child objects as self.baseuris for the given URI """ self.parent.log_message('get children: %s' % uri) @@ -382,7 +400,7 @@ class openerp_dav_handler(dav_interface): if not dbname: if cr: cr.close() - res = map(lambda x: self.urijoin(x), self.db_list()) + res = map(lambda x: self.urijoin(x), self.db_list(uri)) return res result = [] node = self.uri2object(cr, uid, pool, uri2[:]) diff --git a/addons/document_webdav/webdav.py b/addons/document_webdav/webdav.py index bf8b843a0a0..f7780883bda 100644 --- a/addons/document_webdav/webdav.py +++ b/addons/document_webdav/webdav.py @@ -20,6 +20,9 @@ # ############################################################################## +import logging + +_logger = logging.getLogger(__name__) import xml.dom.minidom domimpl = xml.dom.minidom.getDOMImplementation() from xml.dom.minicompat import StringTypes @@ -29,10 +32,14 @@ import urllib from osv import osv from tools.translate import _ -from DAV import utils -from DAV.propfind import PROPFIND -from DAV.report import REPORT - +try: + from pywebdav.lib import utils + from pywebdav.lib.propfind import PROPFIND + from pywebdav.lib.report import REPORT +except ImportError: + from DAV import utils + from DAV.propfind import PROPFIND + from DAV.report import REPORT import tools diff --git a/addons/document_webdav/webdav_server.py b/addons/document_webdav/webdav_server.py index 70ad4d2657f..a23f1a0806b 100644 --- a/addons/document_webdav/webdav_server.py +++ b/addons/document_webdav/webdav_server.py @@ -38,7 +38,16 @@ import logging import netsvc from dav_fs import openerp_dav_handler from tools.config import config -from DAV.WebDAVServer import DAVRequestHandler +try: + from pywebdav.lib.WebDAVServer import DAVRequestHandler + from pywebdav.lib.utils import IfParser, TagList + from pywebdav.lib.errors import DAV_Error, DAV_Forbidden, DAV_NotFound + from pywebdav.lib.propfind import PROPFIND +except ImportError: + from DAV.WebDAVServer import DAVRequestHandler + from DAV.utils import IfParser, TagList + from DAV.errors import DAV_Error, DAV_Forbidden, DAV_NotFound + from DAV.propfind import PROPFIND from service import http_server from service.websrv_lib import FixSendError, HttpOptions from BaseHTTPServer import BaseHTTPRequestHandler @@ -48,9 +57,6 @@ import re import time from string import atoi import addons -from DAV.utils import IfParser, TagList -from DAV.errors import DAV_Error, DAV_Forbidden, DAV_NotFound -from DAV.propfind import PROPFIND # from DAV.constants import DAV_VERSION_1, DAV_VERSION_2 from xml.dom import minidom from redirect import RedirectHTTPHandler @@ -71,7 +77,7 @@ def OpenDAVConfig(**kw): return Config() -class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler): +class DAVHandler(DAVRequestHandler, HttpOptions, FixSendError): verbose = False protocol_version = 'HTTP/1.1' @@ -88,7 +94,20 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler): self._logger.debug(message) def handle(self): - self._init_buffer() + """Handle multiple requests if necessary.""" + self.close_connection = 1 + try: + self.handle_one_request() + while not self.close_connection: + self.handle_one_request() + except Exception as e: + try: + self.log_error("Request timed out: %r \n Trying old version of HTTPServer", e) + self._init_buffer() + except Exception as e: + #a read or a write timed out. Discard this connection + self.log_error("Not working neither, closing connection\n %r", e) + self.close_connection = 1 def finish(self): pass @@ -99,6 +118,7 @@ class DAVHandler(HttpOptions, FixSendError, DAVRequestHandler): return res def setup(self): + DAVRequestHandler.setup(self) self.davpath = '/'+config.get_misc('webdav','vdir','webdav') addr, port = self.server.server_name, self.server.server_port server_proto = getattr(self.server,'proto', 'http').lower() diff --git a/addons/fleet/fleet_demo.xml b/addons/fleet/fleet_demo.xml index 50eb8a3fab1..a8d70eb06fa 100644 --- a/addons/fleet/fleet_demo.xml +++ b/addons/fleet/fleet_demo.xml @@ -1,6 +1,10 @@ + + + + In shop 1 diff --git a/addons/fleet/security/fleet_security.xml b/addons/fleet/security/fleet_security.xml index 6c718f4cdd7..c9b86799b5c 100644 --- a/addons/fleet/security/fleet_security.xml +++ b/addons/fleet/security/fleet_security.xml @@ -8,7 +8,6 @@ User - Manager diff --git a/addons/mail/doc/mail_message.rst b/addons/mail/doc/mail_message.rst index 4a3d3634efa..14055f063e0 100644 --- a/addons/mail/doc/mail_message.rst +++ b/addons/mail/doc/mail_message.rst @@ -53,6 +53,7 @@ ClientAction (ir.actions.client) - ``compose_placeholder`` : Message to display on the textareaboxes. - ``show_link`` : Display partner (authors, followers...) on link or not - ``compose_as_todo`` : The root composer mark automatically the message as todo + - ``readonly`` : Read only mode, hide all action buttons and composer Fields +++++++ diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index dc5583eb951..f873daff9c3 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -1414,6 +1414,7 @@ openerp.mail = function (session) { * @param {String} [no_message] Message to display when there are no message * @param {Boolean} [show_link] Display partner (authors, followers...) on link or not * @param {Boolean} [compose_as_todo] The root composer mark automatically the message as todo + * @param {Boolean} [readonly] Read only mode, hide all action buttons and composer */ init: function (parent, action) { this._super(parent, action); @@ -1435,6 +1436,7 @@ openerp.mail = function (session) { 'view_inbox': false, 'message_ids': undefined, 'compose_as_todo' : false, + 'readonly' : false, }, this.action.params); this.action.params.help = this.action.help || false; @@ -1507,6 +1509,9 @@ openerp.mail = function (session) { if (this.node.attrs.placeholder) { this.node.params.compose_placeholder = this.node.attrs.placeholder; } + if (this.node.attrs.readonly) { + this.node.params.readonly = this.node.attrs.readonly; + } this.domain = this.node.params && this.node.params.domain || []; }, diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 542e4eec7b7..3c510813029 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -20,7 +20,7 @@ mail.compose_message when focus on textarea --> -
+
User img
@@ -38,7 +38,7 @@
-
+