Re: Running into some strange issues.
Adam Tauno Williams <[email protected]> Mon, 21 Dec 2009 10:31:43 -0500
| Newsgroups | gmane.comp.cms.opengroupware.xmlrpc.devel |
|---|---|
| Message-ID | <1261409503.8127.66.camel@linux-m3mt> |
> > So I'm confused. I can take the object and make a very simple program
> > and get the errors.
> > #!/usr/bin/env python
> > import sys, csv, xmlrpclib, time, pg, imppost
> > from time import strftime
> > server =
> > xmlrpclib.Server('http://upsuser:brown@mta1/zidestore/so/upsuser')
> > object = {'_COMPANYVALUES': [{'attribute': 'bai_id', 'value': '0BURPO'},
> > {'attribute': 'salesman', 'value': 'MASTER'}], '_PHONES': [{'info':
> > 'import-12-17-09', 'type': '01_tel', 'number': '(616)459-9531'},
> > {'info': 'import-12-17-09', 'type': '10_fax', 'number':
> > '(616)459-1032'}], 'name': 'BURKE E. PORTER', 'objectId': 0,
> > 'entityName': 'Enterprise', '_ADDRESSES': [{'city': 'GRAND RAPIDS',
> > 'zip': '495O5', 'state': 'MI', 'street': '73O PLYMOUTH ROAD, N. E.',
> > 'name3': '', 'name1': 'BURKE E. PORTER', 'type': 'ship'}, {'city':
> > 'GRAND RAPIDS', 'zip': '495O5', 'state': 'MI', 'street': '73O PLYMOUTH
> > ROAD, N. E.', 'name3': '', 'name1': 'BURKE E. PORTER', 'type': 'bill'}],
> > 'keywords': 'SAS Customers'}
> > print object
> > enterprise = server.zogi.putObject(object)
> > print 'Created Enterprise # %d' % enterprise['objectId']
> > But the errors are not consistent right away. The more I enter, the
> > more likely.
> > It seems to me that I am not getting the database re-established or
> > there is something else I need to do before importing, but I'm not sure
> > what it is.
> > All assistance is appreciated. Thanks in advance.
> I've recently seen something similar and am looking into it. I think a
> cache gets fouled.
A work around is to catch transport errors and re-issue the request,
which is perfectly safe since each request is a transaction
[BEGIN;ROLLBACK/COMMIT].
for attempt in range(1, 3):
try:
... do ...
break
except xmlrpclib.ProtocolError, err:
self.log.warn('Protocol Error, trying again in 0.5 seconds')
self.log.exception(err)
time.sleep(0.5)
The Coils XML-RPC proxy does this automatically.
<http://coils.hg.sourceforge.net/hgweb/coils/coils/file/a60695f74799/src/coils/protocol/proxy/proxy.py>
--
OpenGroupware.org XML-RPC
[email protected]
http://mail.opengroupware.org/mailman/listinfo/xmlrpc