Guest User

Untitled

a guest
Jun 30th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. from openerp.osv import orm, fields
  2. from openerp.addons.magentoerpconnect.unit.backend_adapter import MagentoCRUDAdapter
  3. from openerp.addons.magentoerpconnect.backend import magento1700
  4.  
  5.  
  6. @magento1700
  7. class MagentoCRUDAdapterPhp54(MagentoCRUDAdapter):
  8.  
  9. def _call(self, method, arguments):
  10. print "hola**************************"
  11. try:
  12. custom_url = self.magento.use_custom_api_path
  13. with magentolib.API(self.magento.location,
  14. self.magento.username,
  15. self.magento.password,
  16. full_url=custom_url) as api:
  17. # If magento is used with PHP version >= 5.4, then we have to remove all
  18. # trailing None values
  19. if isinstance(arguments, list) and len(arguments) > 0 and arguments[-1] is None:
  20. arguments = [a for a in arguments if a is not None]
  21.  
  22. result = api.call(method, arguments)
  23. # Uncomment to record requests/responses in ``recorder``
  24. # record(method, arguments, result)
  25. _logger.debug("api.call(%s, %s) returned %s",
  26. method, arguments, result)
  27. return result
  28. except (socket.gaierror, socket.error, socket.timeout) as err:
  29. raise NetworkRetryableError(
  30. 'A network error caused the failure of the job: '
  31. '%s' % err)
  32. except xmlrpclib.ProtocolError as err:
  33. if err.errcode in [502, # Bad gateway
  34. 503, # Service unavailable
  35. 504]: # Gateway timeout
  36. raise RetryableJobError(
  37. 'A protocol error caused the failure of the job:\n'
  38. 'URL: %s\n'
  39. 'HTTP/HTTPS headers: %s\n'
  40. 'Error code: %d\n'
  41. 'Error message: %s\n' %
  42. (err.url, err.headers, err.errcode, err.errmsg))
  43. else:
  44. raise
Advertisement
Add Comment
Please, Sign In to add comment