Vo Minh Thu (OpenERP) has proposed merging
lp:~openerp-dev/openerp-web/trunk-import-hook-vmt into lp:openerp-web.
Requested reviews:
OpenERP R&D Web Team (openerp-dev-web)
For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-import-hook-vmt/+merge/88665
See the similarly named server branch for a description (there is also a
openobject-addons branch).
--
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-import-hook-vmt/+merge/88665
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/trunk-import-hook-vmt.
=== modified file 'addons/web/common/http.py'
--- addons/web/common/http.py 2012-01-13 14:58:32 +0000
+++ addons/web/common/http.py 2012-01-16 11:43:25 +0000
@@ -405,7 +405,7 @@
only used in case the list of databases is requested
by the server, will be filtered by this pattern
"""
- def __init__(self, options):
+ def __init__(self, options, openerp_addons_namespace=True):
self.root = '/web/webclient/home'
self.config = options
@@ -419,7 +419,7 @@
self.session_cookie = 'sessionid'
self.addons = {}
- static_dirs = self._load_addons()
+ static_dirs = self._load_addons(openerp_addons_namespace)
if options.serve_static:
self.dispatch = werkzeug.wsgi.SharedDataMiddleware(
self.dispatch, static_dirs)
@@ -473,15 +473,13 @@
return response(environ, start_response)
- def _load_addons(self):
+ def _load_addons(self, openerp_addons_namespace=True):
"""
Loads all addons at the specified addons path, returns a mapping of
static URLs to the corresponding directories
"""
statics = {}
for addons_path in self.config.addons_path:
- if addons_path not in sys.path:
- sys.path.insert(0, addons_path)
for module in os.listdir(addons_path):
if module not in addons_module:
manifest_path = os.path.join(addons_path, module, '__openerp__.py')
@@ -490,7 +488,10 @@
manifest = ast.literal_eval(open(manifest_path).read())
manifest['addons_path'] = addons_path
_logger.info("Loading %s", module)
- m = __import__(module)
+ if openerp_addons_namespace:
+ m = __import__('openerp.addons.' + module)
+ else:
+ m = __import__(module)
addons_module[module] = m
addons_manifest[module] = manifest
statics['/%s/static' % module] = path_static
=== modified file 'addons/web/controllers/main.py'
--- addons/web/controllers/main.py 2012-01-13 15:06:41 +0000
+++ addons/web/controllers/main.py 2012-01-16 11:43:25 +0000
@@ -23,8 +23,8 @@
except ImportError:
xlwt = None
-import web.common
-openerpweb = web.common.http
+from .. import common
+openerpweb = common.http
#----------------------------------------------------------
# OpenERP Web web Controllers
@@ -259,7 +259,7 @@
@openerpweb.jsonrequest
def version_info(self, req):
return {
- "version": web.common.release.version
+ "version": common.release.version
}
class Proxy(openerpweb.Controller):
@@ -392,7 +392,7 @@
@openerpweb.jsonrequest
def authenticate(self, req, db, login, password, base_location=None):
wsgienv = req.httprequest.environ
- release = web.common.release
+ release = common.release
env = dict(
base_location=base_location,
HTTP_HOST=wsgienv['HTTP_HOST'],
@@ -486,8 +486,8 @@
no group by should be performed)
"""
context, domain = eval_context_and_domain(req.session,
- web.common.nonliterals.CompoundContext(*(contexts or [])),
- web.common.nonliterals.CompoundDomain(*(domains or [])))
+ common.nonliterals.CompoundContext(*(contexts or [])),
+ common.nonliterals.CompoundDomain(*(domains or [])))
group_by_sequence = []
for candidate in (group_by_seq or []):
@@ -847,14 +847,14 @@
def _call_kw(self, req, model, method, args, kwargs):
for i in xrange(len(args)):
- if isinstance(args[i], web.common.nonliterals.BaseContext):
+ if isinstance(args[i], common.nonliterals.BaseContext):
args[i] = req.session.eval_context(args[i])
- elif isinstance(args[i], web.common.nonliterals.BaseDomain):
+ elif isinstance(args[i], common.nonliterals.BaseDomain):
args[i] = req.session.eval_domain(args[i])
for k in kwargs.keys():
- if isinstance(kwargs[k], web.common.nonliterals.BaseContext):
+ if isinstance(kwargs[k], common.nonliterals.BaseContext):
kwargs[k] = req.session.eval_context(kwargs[k])
- elif isinstance(kwargs[k], web.common.nonliterals.BaseDomain):
+ elif isinstance(kwargs[k], common.nonliterals.BaseDomain):
kwargs[k] = req.session.eval_domain(kwargs[k])
return getattr(req.session.model(model), method)(*args, **kwargs)
@@ -933,7 +933,7 @@
xml = self.transform_view(arch, session, evaluation_context)
else:
xml = ElementTree.fromstring(arch)
- fvg['arch'] = web.common.xml2json.Xml2Json.convert_element(xml, preserve_whitespaces)
+ fvg['arch'] = common.xml2json.Xml2Json.convert_element(xml, preserve_whitespaces)
for field in fvg['fields'].itervalues():
if field.get('views'):
@@ -1024,7 +1024,7 @@
def parse_domain(domain, session):
""" Parses an arbitrary string containing a domain, transforms it
- to either a literal domain or a :class:`web.common.nonliterals.Domain`
+ to either a literal domain or a :class:`common.nonliterals.Domain`
:param domain: the domain to parse, if the domain is not a string it
is assumed to be a literal domain and is returned as-is
@@ -1037,11 +1037,11 @@
return ast.literal_eval(domain)
except ValueError:
# not a literal
- return web.common.nonliterals.Domain(session, domain)
+ return common.nonliterals.Domain(session, domain)
def parse_context(context, session):
""" Parses an arbitrary string containing a context, transforms it
- to either a literal context or a :class:`web.common.nonliterals.Context`
+ to either a literal context or a :class:`common.nonliterals.Context`
:param context: the context to parse, if the context is not a string it
is assumed to be a literal domain and is returned as-is
@@ -1053,7 +1053,7 @@
try:
return ast.literal_eval(context)
except ValueError:
- return web.common.nonliterals.Context(session, context)
+ return common.nonliterals.Context(session, context)
class ListView(View):
_cp_path = "/web/listview"
@@ -1117,10 +1117,10 @@
@openerpweb.jsonrequest
def save_filter(self, req, model, name, context_to_save, domain):
Model = req.session.model("ir.filters")
- ctx = web.common.nonliterals.CompoundContext(context_to_save)
+ ctx = common.nonliterals.CompoundContext(context_to_save)
ctx.session = req.session
ctx = ctx.evaluate()
- domain = web.common.nonliterals.CompoundDomain(domain)
+ domain = common.nonliterals.CompoundDomain(domain)
domain.session = req.session
domain = domain.evaluate()
uid = req.session._uid
@@ -1135,10 +1135,10 @@
@openerpweb.jsonrequest
def add_to_dashboard(self, req, menu_id, action_id, context_to_save, domain, view_mode, name=''):
- ctx = web.common.nonliterals.CompoundContext(context_to_save)
+ ctx = common.nonliterals.CompoundContext(context_to_save)
ctx.session = req.session
ctx = ctx.evaluate()
- domain = web.common.nonliterals.CompoundDomain(domain)
+ domain = common.nonliterals.CompoundDomain(domain)
domain.session = req.session
domain = domain.evaluate()
@@ -1584,7 +1584,7 @@
report_srv = req.session.proxy("report")
context = req.session.eval_context(
- web.common.nonliterals.CompoundContext(
+ common.nonliterals.CompoundContext(
req.context or {}, action[ "context"]))
report_data = {}
=== modified file 'openerp-web'
--- openerp-web 2011-10-26 17:38:57 +0000
+++ openerp-web 2012-01-16 11:43:25 +0000
@@ -86,7 +86,7 @@
else:
logging.basicConfig(level=getattr(logging, options.log_level.upper()))
- app = web.common.http.Root(options)
+ app = web.common.http.Root(options, openerp_addons_namespace=False)
if options.proxy_mode:
app = werkzeug.contrib.fixers.ProxyFix(app)
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp