Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from openerp.osv import orm, fields
- from openerp.addons.magentoerpconnect.unit.backend_adapter import MagentoCRUDAdapter
- from openerp.addons.magentoerpconnect.backend import magento1700
- @magento1700
- class MagentoCRUDAdapterPhp54(MagentoCRUDAdapter):
- def _call(self, method, arguments):
- print "hola**************************"
- try:
- custom_url = self.magento.use_custom_api_path
- with magentolib.API(self.magento.location,
- self.magento.username,
- self.magento.password,
- full_url=custom_url) as api:
- # If magento is used with PHP version >= 5.4, then we have to remove all
- # trailing None values
- if isinstance(arguments, list) and len(arguments) > 0 and arguments[-1] is None:
- arguments = [a for a in arguments if a is not None]
- result = api.call(method, arguments)
- # Uncomment to record requests/responses in ``recorder``
- # record(method, arguments, result)
- _logger.debug("api.call(%s, %s) returned %s",
- method, arguments, result)
- return result
- except (socket.gaierror, socket.error, socket.timeout) as err:
- raise NetworkRetryableError(
- 'A network error caused the failure of the job: '
- '%s' % err)
- except xmlrpclib.ProtocolError as err:
- if err.errcode in [502, # Bad gateway
- 503, # Service unavailable
- 504]: # Gateway timeout
- raise RetryableJobError(
- 'A protocol error caused the failure of the job:\n'
- 'URL: %s\n'
- 'HTTP/HTTPS headers: %s\n'
- 'Error code: %d\n'
- 'Error message: %s\n' %
- (err.url, err.headers, err.errcode, err.errmsg))
- else:
- raise
Advertisement
Add Comment
Please, Sign In to add comment