In Python 3: * various builtins and dict methods were changed to return view/iterable objects rather than lists * and the separate Python 2 view/iterable builtins and methods were removed altogether This is problematic when using these items as list (which the happens repeatedly in Odoo), but more viciously when iterating *multiple times* over them (which also happens, which I've messed up multiple times while writing this, and which is a pain to debug even when you've just created the issue). Convert all code using these to semantics-matching cross-version helper functions to get the LCD behaviour between P2 and P3, and forbid the builtins via lint. issue #8530
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
import logging
|
|
import pprint
|
|
import werkzeug
|
|
|
|
from odoo import http
|
|
from odoo.http import request
|
|
from odoo.tools import pycompat
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
class BuckarooController(http.Controller):
|
|
_return_url = '/payment/buckaroo/return'
|
|
_cancel_url = '/payment/buckaroo/cancel'
|
|
_exception_url = '/payment/buckaroo/error'
|
|
_reject_url = '/payment/buckaroo/reject'
|
|
|
|
@http.route([
|
|
'/payment/buckaroo/return',
|
|
'/payment/buckaroo/cancel',
|
|
'/payment/buckaroo/error',
|
|
'/payment/buckaroo/reject',
|
|
], type='http', auth='none', csrf=False)
|
|
def buckaroo_return(self, **post):
|
|
""" Buckaroo."""
|
|
_logger.info('Buckaroo: entering form_feedback with post data %s', pprint.pformat(post)) # debug
|
|
request.env['payment.transaction'].sudo().form_feedback(post, 'buckaroo')
|
|
post = {key.upper(): value for key, value in pycompat.items(post)}
|
|
return_url = post.get('ADD_RETURNDATA') or '/'
|
|
return werkzeug.utils.redirect(return_url)
|