Re: Running into some strange issues.

Adam Tauno Williams <[email protected]> Thu, 17 Dec 2009 18:06:37 -0500
Newsgroups gmane.comp.cms.opengroupware.xmlrpc.devel
Message-ID <1261091197.10427.3.camel@linux-m3mt>
On Thu, 2009-12-17 at 13:11 -0500, Dirk H Bartley wrote:
> Greetings
> Hopefully someone can assist with some strange issue I have here.
> So I'm using some python scripts to import data into ogo.  I am having
> issues with my second script.
> The effort here is to be able to start from a blank fresh database.
> So after this I log in as the upsuser in the web based interface just to
> get the user added.  Going to the web interface does not automatically
> connect as root as I would have expected from wmogag.

The initial admin login is based on if there is a password set for the
admin user (account#10,000).  But you may have defaults where you have
configured LDAP authentication;  those are stored in
$OGO_HOME/.libfoundation.  So wiping the database won't remove your
authentication setup.

> then I am able to run one of the python import scripts successfully.  It
> imports data from our erp.
> The second one gives me errors, but not till about the 5th or so record.
> Then pukes with:
> <begin>
> Creating new enterprise in impgold.py importcust
> {'_COMPANYVALUES': [{'attribute': 'bai_id', 'value': '0ALCTU'},
> {'attribute': 'salesman', 'value': 'MASTER'}], '_PHONES': [{'info':
> 'import-12-17-09', 'type': '01_tel', 'number': '(313)537-7510'},
> {'info': 'import-12-17-09', 'type': '10_fax', 'number':
> '(313)537-9017'}], 'name': 'ALCO TURNING CO., INC.', 'objectId': 0,
> 'entityName': 'Enterprise', '_ADDRESSES': [{'city': 'REDFORD', 'zip':
> '48240', 'state': 'MI', 'street': '25610 W 7 MILE ROAD', 'name3': '',
> 'name1': 'ALCO TURNING CO., INC.', 'type': 'ship'}, {'city': 'REDFORD',
> 'zip': '48240', 'state': 'MI', 'street': '25610 W 7 MILE ROAD', 'name3':
> '', 'name1': 'ALCO TURNING CO., INC.', 'type': 'bill'}], 'keywords':
> 'SAS Customers'}
> Traceback (most recent call last):
>   File "./importgoldcontact1", line 78, in ?
>     ogoid = impgold.importcust(server, arr)
>   File "/home/SCHUPAN/dbartley/ogoimport/impgold.py", line 82, in
> importcust
>     enterprise = server.zogi.putObject(object)
>   File "/usr/lib64/python2.4/xmlrpclib.py", line 1096, in __call__
>     return self.__send(self.__name, args)
>   File "/usr/lib64/python2.4/xmlrpclib.py", line 1383, in __request
>     verbose=self.__verbose
>   File "/usr/lib64/python2.4/xmlrpclib.py", line 1147, in request
>     return self._parse_response(h.getfile(), sock)
>   File "/usr/lib64/python2.4/xmlrpclib.py", line 1286, in
> _parse_response
>     return u.close()
>   File "/usr/lib64/python2.4/xmlrpclib.py", line 744, in close
>     raise Fault(**self._stack[0])
> xmlrpclib.Fault: <Fault 0: 'AssertException: error during save of
> attachment to  or  {\n    methodName = "zogi.putObject";\n
> methodParameters = (\n        {\n            "_ADDRESSES" = (\n
> {\n                    city = REDFORD;\n                    name1 =
> "ALCO TURNING CO., INC.";\n                    name3 = "";\n
> state = MI;\n                    street = "25610 W 7 MILE ROAD";\n
> type = ship;\n                    zip = 48240;\n                },\n
> {\n                    city = REDFORD;\n                    name1 =
> "ALCO TURNING CO., INC.";\n                    name3 = "";\n
> state = MI;\n                    street = "25610 W 7 MILE ROAD";\n
> type = bill;\n                    zip = 48240;
> \n                }\n            );\n            "_COMPANYVALUES" = (\n
> {\n                    attribute = "bai_id";\n                    value
> = 0ALCTU;\n                },\n                {\n
> attribute = salesman;\n                    value = MASTER;
> \n                }\n            );\n            "_PHONES" = (\n
> {\n                    info = "import-12-17-09";\n
> number = "(313)537-7510";\n                    type = "01_tel";
> \n                },\n                {\n                    info =
> "import-12-17-09";\n                    number = "(313)537-9017";\n
> type = "10_fax";\n                }\n            );\n
> entityName = Enterprise;\n            keywords = "SAS Customers";\n
> name = "ALCO TURNING CO., INC.";\n            objectId = 0;
> \n        }\n    );\n}'>
> <end>
> 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.

-- 
OpenGroupware.org XML-RPC
[email protected]
http://mail.opengroupware.org/mailman/listinfo/xmlrpc