Re: Re: questions regardingZOGi,WAS:[OGo-Users]custom fields and synchronizing ogo
"Sebastian Reitenbach" <[email protected]> Fri, 28 Mar 2008 12:28:43 +0100
| Newsgroups | gmane.comp.cms.opengroupware.xmlrpc.devel |
|---|---|
| Organization | L00 bugdead prods. |
| Message-ID | <[email protected]> |
[email protected] wrote: > > > One moment while I check the code.... > > > Nope, zOGI doesn't support retrieving the contact_id (as contactId). > > > But it should support writing it, just set "contactId: 10160" for > > > example. Since "contactId" is an attribute known to OGo Logic it should > > > just set it. > > > That should be corrected in zOGI r951 (Google Code version). > > I don't need to retrieve this information, but writing it, works great!! > > So creation of new companies works great. But still, as mentioned, I get the > > python backtrace when I try updating a company. I have to retrieve the old > > object_version from the database, and then add 1. When I then update the > > company, with the new version, then updating works well too. > > Maybe as an enhancement, zOGI could figure out the old object version, and > > creating a new one, when it is updating a record? > > That's not a bug, its a feature! :) You can specify the "ignoreVersion" > flag when you do the putObject and it will disable version checking and > just-do-the-$*@(*&$(*-write! Version detection is there for > applications that operate online and then come back and want to commit > their changes; version checking prevents them from updating a > contact/enterprise that was updated on the server while they were gone. > It is entirely intended that you need to getObject in order to putObject > when doing an update. > ok, id did not a getObject, as I find the information otherwise, the ignoreVersion is just the hint I needed. > You shouldn't need to bump the version number, the version number needs > to be equal to the version on the server. I added 1 to the object_version I found in the database, and that did not worked, I had the assumption, that I need to specify the next version, when I do an update, and not the version that I want to update. I ran into an python exception, when I tried to update with this: Updating Enterprise /usr/lib64/python2.4/xmllib.py:9: DeprecationWarning: The xmllib module is obsolete. Use xml.sax instead. warnings.warn("The xmllib module is obsolete. Use xml.sax instead.", DeprecationWarning) Traceback (most recent call last): File "./create_or_update_company.py", line 105, in ? enterprise = server.zogi.putObject( 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: 'HTTP 500: Client object is out of date'> specifying the flag, "fixes" the problem for me. > > <quote> > /* Object version check is not performed if ignoreVersion flag > was provided by the client. But this is generally a bad idea > and clients should ONLY use this to offer an explicit force- > overwrite option. */ > if (!([_flags containsObject:@"ignoreVersion"])) { > if ([_company objectForKey:@"version"] == nil) > return [NSException exceptionWithHTTPStatus:500 > reason:@"No version supplied on company update"]; > if ([[_company objectForKey:@"version"] intValue] != > [[eo objectForKey:@"objectVersion"] intValue]) { > if ([self isDebug]) { > [self warnWithFormat:@"Client object version: %@", > [_company objectForKey:@"version"]]; > [self warnWithFormat:@"Server object version: %@", > [eo objectForKey:@"objectVersion"]]; > } > return [NSException exceptionWithHTTPStatus:500 > reason:@"Client object is out of date"]; > } > } /* If ignoreVersion-not-specified */ > </quote> thanks a lot Sebastian -- OpenGroupware.org XML-RPC [email protected] http://mail.opengroupware.org/mailman/listinfo/xmlrpc