[IMP] manual urllib.quote_plus -> bulk urllib.urlencode

bzr revid: xmo@openerp.com-20130724085921-tc6mnnb2a4g4jmvu
This commit is contained in:
Xavier Morel
2013-07-24 10:59:21 +02:00
parent 5fc0d839ee
commit 7eb03e5a46
+12 -7
View File
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
import urllib
import openerp
from openerp.addons.web import http
from openerp.addons.web.controllers.main import manifest_list
from urllib import quote_plus
from openerp.addons.web.http import request
def template_values():
@@ -68,12 +69,16 @@ class Website(openerp.addons.web.controllers.main.Home):
'inherit_branding': values['editable'],
}
company = request.registry['res.company'].browse(request.cr, uid, 1, context=context)
values.update({
'res_company': company,
'path': path
})
values['google_map_url'] = "http://maps.googleapis.com/maps/api/staticmap?center=%s&sensor=false&zoom=8&size=298x298" \
% quote_plus('%s, %s %s, %s' % (company.street, company.city, company.zip, company.country_id and company.country_id.name_get()[0][1] or ''))
values.update(
res_company=company,
path=path,
google_map_url="http://maps.googleapis.com/maps/api/staticmap?" + urllib.urlencode({
'center': '%s, %s %s, %s' % (company.street, company.city, company.zip, company.country_id and company.country_id.name_get()[0][1] or ''),
'sensor': 'false',
'zoom': '8',
'size': '298x298',
}),
)
try:
html = request.registry.get("ir.ui.view").render(request.cr, uid, path, values, context)
except ValueError, e: