[FIX] *: using werkzeug.url_encode instead of urllib.urlencode because urliblib.encode does not accept unicode
bzr revid: dle@openerp.com-20140129121316-b5f5e4r6fz9l80kq
This commit is contained in:
parent
911d95eabd
commit
0306adbfe3
|
@ -1,6 +1,6 @@
|
|||
import logging
|
||||
|
||||
import urllib
|
||||
import werkzeug.urls
|
||||
import urlparse
|
||||
import urllib2
|
||||
import simplejson
|
||||
|
@ -25,7 +25,7 @@ class res_users(osv.Model):
|
|||
]
|
||||
|
||||
def _auth_oauth_rpc(self, cr, uid, endpoint, access_token, context=None):
|
||||
params = urllib.urlencode({'access_token': access_token})
|
||||
params = werkzeug.url_encode({'access_token': access_token})
|
||||
if urlparse.urlparse(endpoint)[4]:
|
||||
url = endpoint + '&' + params
|
||||
else:
|
||||
|
|
|
@ -24,7 +24,7 @@ from openerp import SUPERUSER_ID
|
|||
from openerp.tools.translate import _
|
||||
from openerp.addons.web.http import request
|
||||
|
||||
import urllib
|
||||
import werkzeug.urls
|
||||
import urllib2
|
||||
import simplejson
|
||||
|
||||
|
@ -43,7 +43,7 @@ class google_service(osv.osv_memory):
|
|||
#Get the Refresh Token From Google And store it in ir.config_parameter
|
||||
headers = {"Content-type": "application/x-www-form-urlencoded"}
|
||||
data = dict(code=authorization_code, client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, grant_type="authorization_code")
|
||||
data = urllib.urlencode(data)
|
||||
data = werkzeug.url_encode(data)
|
||||
try:
|
||||
req = urllib2.Request("https://accounts.google.com/o/oauth2/token", data, headers)
|
||||
content = urllib2.urlopen(req).read()
|
||||
|
@ -62,7 +62,7 @@ class google_service(osv.osv_memory):
|
|||
'response_type': 'code',
|
||||
'client_id': ir_config.get_param(cr, SUPERUSER_ID, 'google_%s_client_id' % service),
|
||||
}
|
||||
uri = 'https://accounts.google.com/o/oauth2/auth?%s' % urllib.urlencode(params)
|
||||
uri = 'https://accounts.google.com/o/oauth2/auth?%s' % werkzeug.url_encode(params)
|
||||
return uri
|
||||
|
||||
#If no scope is passed, we use service by default to get a default scope
|
||||
|
@ -83,7 +83,7 @@ class google_service(osv.osv_memory):
|
|||
'access_type':'offline'
|
||||
}
|
||||
|
||||
uri = self.get_uri_oauth(a='auth') + "?%s" % urllib.urlencode(params)
|
||||
uri = self.get_uri_oauth(a='auth') + "?%s" % werkzeug.url_encode(params)
|
||||
return uri
|
||||
|
||||
def _get_google_token_json(self, cr, uid, authorize_code, service, context=None):
|
||||
|
@ -103,7 +103,7 @@ class google_service(osv.osv_memory):
|
|||
headers = {"content-type": "application/x-www-form-urlencoded"}
|
||||
|
||||
try:
|
||||
data = urllib.urlencode(params)
|
||||
data = werkzeug.url_encode(params)
|
||||
req = urllib2.Request(self.get_uri_oauth(a='token'), data, headers)
|
||||
|
||||
content = urllib2.urlopen(req).read()
|
||||
|
@ -128,7 +128,7 @@ class google_service(osv.osv_memory):
|
|||
headers = {"content-type": "application/x-www-form-urlencoded"}
|
||||
|
||||
try:
|
||||
data = urllib.urlencode(params)
|
||||
data = werkzeug.url_encode(params)
|
||||
req = urllib2.Request(self.get_uri_oauth(a='token'), data, headers)
|
||||
content = urllib2.urlopen(req).read()
|
||||
res = simplejson.loads(content)
|
||||
|
@ -139,12 +139,12 @@ class google_service(osv.osv_memory):
|
|||
|
||||
|
||||
def _do_request(self,cr,uid,uri,params={},headers={},type='POST', context=None):
|
||||
_logger.debug("Uri: %s - Type : %s - Headers: %s - Params : %s !" % (uri,type,headers,urllib.urlencode(params) if type =='GET' else params))
|
||||
_logger.debug("Uri: %s - Type : %s - Headers: %s - Params : %s !" % (uri,type,headers,werkzeug.url_encode(params) if type =='GET' else params))
|
||||
res = False
|
||||
|
||||
try:
|
||||
if type.upper() == 'GET' or type.upper() == 'DELETE':
|
||||
data = urllib.urlencode(params)
|
||||
data = werkzeug.url_encode(params)
|
||||
req = urllib2.Request(self.get_uri_api() + uri + "?" + data)
|
||||
elif type.upper() == 'POST' or type.upper() == 'PATCH' or type.upper() == 'PUT':
|
||||
req = urllib2.Request(self.get_uri_api() + uri, params, headers)
|
||||
|
|
|
@ -23,7 +23,7 @@ from openerp import SUPERUSER_ID
|
|||
from openerp.osv import fields, osv
|
||||
from openerp.tools.translate import _
|
||||
|
||||
import urllib
|
||||
import werkzeug.urls
|
||||
import urllib2
|
||||
import json
|
||||
import re
|
||||
|
@ -70,7 +70,7 @@ class config(osv.Model):
|
|||
google_drive_client_secret = ir_config.get_param(cr, SUPERUSER_ID, 'google_drive_client_secret')
|
||||
#For Getting New Access Token With help of old Refresh Token
|
||||
|
||||
data = urllib.urlencode(dict(client_id=google_drive_client_id,
|
||||
data = werkzeug.url_encode(dict(client_id=google_drive_client_id,
|
||||
refresh_token=google_drive_refresh_token,
|
||||
client_secret=google_drive_client_secret,
|
||||
grant_type="refresh_token",
|
||||
|
|
|
@ -23,7 +23,7 @@ import simplejson
|
|||
import logging
|
||||
from lxml import etree
|
||||
import re
|
||||
import urllib
|
||||
import werkzeug.urls
|
||||
import urllib2
|
||||
|
||||
from openerp.osv import osv
|
||||
|
@ -89,7 +89,7 @@ class config(osv.osv):
|
|||
|
||||
try:
|
||||
req = urllib2.Request(
|
||||
'https://spreadsheets.google.com/feeds/cells/%s/od6/private/full/batch?%s' % (spreadsheet_key, urllib.urlencode({'v': 3, 'access_token': access_token})),
|
||||
'https://spreadsheets.google.com/feeds/cells/%s/od6/private/full/batch?%s' % (spreadsheet_key, werkzeug.url_encode({'v': 3, 'access_token': access_token})),
|
||||
data=request,
|
||||
headers={'content-type': 'application/atom+xml', 'If-Match': '*'})
|
||||
urllib2.urlopen(req)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import datetime
|
||||
import logging
|
||||
import sys
|
||||
import urllib
|
||||
import werkzeug.urls
|
||||
import urllib2
|
||||
|
||||
import openerp
|
||||
|
@ -59,7 +59,7 @@ def get_sys_logs(self, cr, uid):
|
|||
|
||||
add_arg = {"timeout":30} if sys.version_info >= (2,6) else {}
|
||||
arguments = {'arg0': msg, "action": "update",}
|
||||
arguments_raw = urllib.urlencode(arguments)
|
||||
arguments_raw = werkzeug.url_encode(arguments)
|
||||
|
||||
url = config.get("publisher_warranty_url")
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Module to talk to EtherpadLite API."""
|
||||
|
||||
import json
|
||||
import urllib
|
||||
import werkzeug.urls
|
||||
import urllib2
|
||||
|
||||
|
||||
|
@ -32,7 +32,7 @@ class EtherpadLiteClient:
|
|||
|
||||
params = arguments or {}
|
||||
params.update({'apikey': self.apiKey})
|
||||
data = urllib.urlencode(params, True)
|
||||
data = werkzeug.url_encode(params, True)
|
||||
|
||||
try:
|
||||
opener = urllib2.build_opener()
|
||||
|
|
|
@ -6,7 +6,6 @@ except ImportError:
|
|||
import json
|
||||
import logging
|
||||
import pprint
|
||||
import urllib
|
||||
import urllib2
|
||||
import werkzeug
|
||||
|
||||
|
@ -41,7 +40,7 @@ class PaypalController(http.Controller):
|
|||
Once data is validated, process it. """
|
||||
res = False
|
||||
new_post = dict(post, cmd='_notify-validate')
|
||||
urequest = urllib2.Request("https://www.sandbox.paypal.com/cgi-bin/webscr", urllib.urlencode(new_post))
|
||||
urequest = urllib2.Request("https://www.sandbox.paypal.com/cgi-bin/webscr", werkzeug.url_encode(new_post))
|
||||
uopen = urllib2.urlopen(urequest)
|
||||
resp = uopen.read()
|
||||
if resp == 'VERIFIED':
|
||||
|
|
|
@ -7,7 +7,7 @@ except ImportError:
|
|||
import json
|
||||
import logging
|
||||
import urlparse
|
||||
import urllib
|
||||
import werkzeug.urls
|
||||
import urllib2
|
||||
|
||||
from openerp.addons.payment.models.payment_acquirer import ValidationError
|
||||
|
@ -134,7 +134,7 @@ class AcquirerPaypal(osv.Model):
|
|||
password manager
|
||||
"""
|
||||
res = dict.fromkeys(ids, False)
|
||||
parameters = urllib.urlencode({'grant_type': 'client_credentials'})
|
||||
parameters = werkzeug.url_encode({'grant_type': 'client_credentials'})
|
||||
|
||||
for acquirer in self.browse(cr, uid, ids, context=context):
|
||||
tx_url = self._get_paypal_urls(cr, uid, acquirer.env)['paypal_rest_url']
|
||||
|
|
|
@ -279,7 +279,7 @@ class website(osv.osv):
|
|||
def get_url(page):
|
||||
_url = "%spage/%s/" % (url, page)
|
||||
if url_args:
|
||||
_url = "%s?%s" % (_url, urllib.urlencode(url_args))
|
||||
_url = "%s?%s" % (_url, werkzeug.url_encode(url_args))
|
||||
return _url
|
||||
|
||||
return {
|
||||
|
@ -446,7 +446,7 @@ class website(osv.osv):
|
|||
|
||||
get_args.setdefault('kanban', "")
|
||||
kanban = get_args.pop('kanban')
|
||||
kanban_url = "?%s&kanban=" % urllib.urlencode(get_args)
|
||||
kanban_url = "?%s&kanban=" % werkzeug.url_encode(get_args)
|
||||
|
||||
pages = {}
|
||||
for col in kanban.split(","):
|
||||
|
|
|
@ -4,6 +4,7 @@ import urllib
|
|||
import urlparse
|
||||
import unittest2
|
||||
import urllib2
|
||||
import werkzeug.urls
|
||||
|
||||
import lxml.html
|
||||
|
||||
|
@ -70,7 +71,7 @@ class CrawlSuite(unittest2.TestSuite):
|
|||
if user is not None:
|
||||
url = 'http://localhost:{port}/login?{query}'.format(
|
||||
port=tools.config['xmlrpc_port'],
|
||||
query=urllib.urlencode({
|
||||
query=werkzeug.url_encode({
|
||||
'db': tools.config['db_name'],
|
||||
'login': user,
|
||||
'key': password,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import urllib
|
||||
import werkzeug.urls
|
||||
|
||||
import openerp
|
||||
from openerp import SUPERUSER_ID
|
||||
|
@ -89,7 +89,7 @@ class WebsiteCrmPartnerAssign(http.Controller):
|
|||
'google_map_partner_ids': google_map_partner_ids,
|
||||
'pager': pager,
|
||||
'searches': post,
|
||||
'search_path': "?%s" % urllib.urlencode(post),
|
||||
'search_path': "?%s" % werkzeug.url_encode(post),
|
||||
}
|
||||
return request.website.render("website_crm_partner_assign.index", values)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ from openerp.addons.web import http
|
|||
from openerp.tools.translate import _
|
||||
from openerp.addons.web.http import request
|
||||
from openerp.addons.website_partner.controllers import main as website_partner
|
||||
import urllib
|
||||
import werkzeug.urls
|
||||
|
||||
|
||||
class WebsiteCustomer(http.Controller):
|
||||
|
@ -71,7 +71,7 @@ class WebsiteCustomer(http.Controller):
|
|||
'google_map_partner_ids': google_map_partner_ids,
|
||||
'pager': pager,
|
||||
'post': post,
|
||||
'search_path': "?%s" % urllib.urlencode(post),
|
||||
'search_path': "?%s" % werkzeug.url_encode(post),
|
||||
}
|
||||
return request.website.render("website_customer.index", values)
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ controllers = controllers()
|
|||
from datetime import datetime, timedelta
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from openerp import tools
|
||||
import urllib
|
||||
import werkzeug.urls
|
||||
|
||||
class website_event(http.Controller):
|
||||
@http.route(['/event/', '/event/page/<int:page>'], type='http', auth="public", website=True, multilang=True)
|
||||
|
@ -155,7 +155,7 @@ class website_event(http.Controller):
|
|||
'countries': countries,
|
||||
'pager': pager,
|
||||
'searches': searches,
|
||||
'search_path': "?%s" % urllib.urlencode(searches),
|
||||
'search_path': "?%s" % werkzeug.url_encode(searches),
|
||||
}
|
||||
|
||||
return request.website.render("website_event.index", values)
|
||||
|
|
|
@ -7,7 +7,7 @@ from openerp.addons.web.http import request
|
|||
from openerp.addons.website_partner.controllers import main as website_partner
|
||||
from openerp.tools.translate import _
|
||||
|
||||
import urllib
|
||||
import werkzeug.urls
|
||||
|
||||
|
||||
class WebsiteMembership(http.Controller):
|
||||
|
@ -87,7 +87,7 @@ class WebsiteMembership(http.Controller):
|
|||
'google_map_partner_ids': google_map_partner_ids,
|
||||
'pager': pager,
|
||||
'post': post,
|
||||
'search': "?%s" % urllib.urlencode(post),
|
||||
'search': "?%s" % werkzeug.url_encode(post),
|
||||
}
|
||||
return request.website.render("website_membership.index", values)
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import random
|
||||
import simplejson
|
||||
import urllib
|
||||
import werkzeug
|
||||
|
||||
from openerp import SUPERUSER_ID
|
||||
|
@ -634,7 +633,7 @@ class Ecommerce(http.Controller):
|
|||
})
|
||||
|
||||
acquirer_form_post_url = payment_obj.get_form_action_url(cr, uid, acquirer_id, context=context)
|
||||
acquirer_total_url = '%s?%s' % (acquirer_form_post_url, urllib.urlencode(post))
|
||||
acquirer_total_url = '%s?%s' % (acquirer_form_post_url, werkzeug.url_encode(post))
|
||||
return request.redirect(acquirer_total_url)
|
||||
|
||||
@http.route('/shop/payment/get_status/<int:sale_order_id>', type='json', auth="public", website=True, multilang=True)
|
||||
|
|
Loading…
Reference in New Issue