From xmlrpc@opengroupware.org Mon Mar 24 22:58:58 2008 From: xmlrpc@opengroupware.org (Adam Tauno Williams) Date: Mon, 24 Mar 2008 18:58:58 -0400 Subject: [OGo-XML-RPC] Change to zOGI Protocol Message-ID: <1206399538.4667.11.camel@aleph> A change has been made to the zOGI protocol that may break some apps. Prior to ZideStore r2102 and zOGI r943 the entity name of a notation was inconsistent; it is now always "note" . From xmlrpc@opengroupware.org Tue Mar 25 14:41:06 2008 From: xmlrpc@opengroupware.org (Sebastian Reitenbach) Date: Tue, 25 Mar 2008 15:41:06 +0100 Subject: [OGo-XML-RPC] Re: questions regarding ZOGi, WAS: [OGo-Users] custom fields and synchronizing ogo Message-ID: <20080325144106.9090A85874@smtp.l00-bugdead-prods.de> Hi, users@opengroupware.org wrote: > > then I need to create it. What is the best way to do this with an actual ogo > > version? Some years ago, I initially filled my ogo db with > > contacts/enterprises using the import_perscomp.py script. Is this still the > > best way to do, or is there, meanwhile, a better way, using ZOGi or sth. > > else? > > Of course, I'd recommend zOGI. I've numerous example sync scripts; our > marketing department imports contact lists via zOGI on a regular basis. > I think some scripts are in the archive of the xmlrpc@ > list. Post over > there for zOGI specific questions. And there is a relatively > sophisticated example in the zOGI Wiki > I took a look at the script, and it looks promising, that I can tweak it, until it will fit my needs. Well, I don't nearly know anything about python and ZOGi, so I have some questions: I assume the two lines below the import line have to be on a single line? Then I see a lot of, maybe only in my eyes, magic numbers, e.g.: permissions = [ { 'operations' : 'rw', 'targetObjectId' : 970990 }, { 'operations' : 'rw', 'targetObjectId' : 11530 } ] are 11530 and 970990 object ID values of accounts or teams in ogo? then, a little bit later when creating the Enterprise: ... '_ACCESS' : permissions, '_COMPANYVALUES' : [ { 'attribute' : 'division', 'value' : 'WYC' }, { 'attribute' : 'salesperson', 'value' : row[0] }, ... I assume this will create all companies with a "division" attribute with value WYC? also, I don't think that this is really relevant, but I'm wondering, what is the reason for this statement at the end of the script: if counter == 250: time.sleep(5) counter = 0 else: time.sleep(0.2) counter = counter + 1 Do I can use ZOGi from within a different (scripting) language, e.g. just a shell script? If so, are there example scripts available somewhere too? kind regards Sebastian > > -- > OpenGroupware.org Users > users@opengroupware.org > http://mail.opengroupware.org/mailman/listinfo/users > From xmlrpc@opengroupware.org Tue Mar 25 15:50:20 2008 From: xmlrpc@opengroupware.org (Adam Tauno Williams) Date: Tue, 25 Mar 2008 11:50:20 -0400 Subject: [OGo-XML-RPC] Re: questions regarding ZOGi, WAS: [OGo-Users] custom fields and synchronizing ogo In-Reply-To: <20080325144106.9090A85874@smtp.l00-bugdead-prods.de> References: <20080325144106.9090A85874@smtp.l00-bugdead-prods.de> Message-ID: <1206460220.4729.25.camel@WM_ADAM1.morrison.iserv.net> > I assume the two lines below the import line have to be on a single line? yep. > Then I see a lot of, maybe only in my eyes, magic numbers, e.g.: > permissions = [ { 'operations' : 'rw', > 'targetObjectId' : 970990 }, > { 'operations' : 'rw', > 'targetObjectId' : 11530 } ] > are 11530 and 970990 object ID values of accounts or teams in ogo? Teams; these permissions "rw" for teams 970990 & 11530 are set on all imported values. Obviously that would be different or unnecessary depending on the site. They can be objectIds of accounts or teams. > then, a little bit later when creating the Enterprise: > ... > '_ACCESS' : permissions, > '_COMPANYVALUES' : [ { 'attribute' : 'division', > 'value' : 'WYC' }, > { 'attribute' : 'salesperson', > 'value' : row[0] }, > ... > I assume this will create all companies with a "division" attribute with > value WYC? Yep. > also, I don't think that this is really relevant, but I'm wondering, what is > the reason for this statement at the end of the script: > if counter == 250: > time.sleep(5) > counter = 0 > else: > time.sleep(0.2) > counter = counter + 1 Just to pause the load; on a production server we always pause the load so the load process doesn't consume an entire instance. This keeps the request queue from getting so deep that interactive user applications notice a slow down. Modern workstations can fire requests at a server at a pretty amazing rate, even from a scripting language like Python. > Do I can use ZOGi from within a different (scripting) language, Sure, any language that supports XML-RPC (Java, Jython, C#, C, Perl, PHP, etc...) > e.g. just a shell script? Probably not. > If so, are there example scripts available somewhere too? There are examples for Python, PHP, and Jython. http://code.google.com/p/zogi/wiki/PHP http://code.google.com/p/zogi/wiki/Jython From xmlrpc@opengroupware.org Thu Mar 27 11:41:06 2008 From: xmlrpc@opengroupware.org (Sebastian Reitenbach) Date: Thu, 27 Mar 2008 12:41:06 +0100 Subject: [OGo-XML-RPC] Re: questions regarding ZOGi, WAS: [OGo-Users]custom fields and synchronizing ogo Message-ID: <20080327114107.8FC1585FC0@smtp.l00-bugdead-prods.de> Hi Adam, xmlrpc@opengroupware.org wrote: > > I assume the two lines below the import line have to be on a single line? > > yep. > > > Then I see a lot of, maybe only in my eyes, magic numbers, e.g.: > > permissions = [ { 'operations' : 'rw', > > 'targetObjectId' : 970990 }, > > { 'operations' : 'rw', > > 'targetObjectId' : 11530 } ] > > are 11530 and 970990 object ID values of accounts or teams in ogo? > > Teams; these permissions "rw" for teams 970990 & 11530 are set on all > imported values. Obviously that would be different or unnecessary > depending on the site. They can be objectIds of accounts or teams. > > > then, a little bit later when creating the Enterprise: > > ... > > '_ACCESS' : permissions, > > '_COMPANYVALUES' : [ { 'attribute' : 'division', > > 'value' : 'WYC' }, > > { 'attribute' : 'salesperson', > > 'value' : row[0] }, > > ... > > I assume this will create all companies with a "division" attribute with > > value WYC? > > Yep. > I took a look at the example scripts on the zogi wiki, and I am able to create a company, also the extended attributes. I am having a problem creating adding the contact_id to an enterprise. I took a look into the wiki, putObject examples, there you do sth like this: ... person = {} person['targetObjectId'] = 10160 ... enterprise['_CONTACTS'] = [ person ] ... enterprise = server.zogi.putObject(enterprise) The script I use, is: #!/usr/bin/env python # all intranet: 10003 # import sys, csv, xmlrpclib, time server = xmlrpclib.Server('http://admin:pw@localhost/zidestore/so/ogoroot') permissions = [ { 'operations' : 'rw', 'targetObjectId' : 10003 } ] counter = 0 reader = csv.reader(open("/root/bin/company.csv", "rb"), delimiter='|', quoting=csv.QUOTE_NONE) for row in reader: print 'Creating new enterprise' person = {} person['targetObjectId'] = row[11] enterprise = server.zogi.putObject( { 'objectId' : 0, 'entityName' : 'Enterprise', 'name' : row[1], 'url' : row[2], '_ADDRESSES' : [ { 'name1' : row[1], 'street' : row[3], 'city' : row[6], 'state' : row[5], 'zip' : row[4], 'type' : 'ship' } ], '_ACCESS' : permissions, '_CONTACTS' : person, '_COMPANYVALUES' : [ { 'attribute' : 'contact_segments', 'value' : row[7] }, { 'attribute' : 'contact_markets', 'value' : row[8] }, { 'attribute' : 'country', 'value' : row[9] }, { 'attribute' : 'continent', 'value' : row[10] }, { 'attribute' : 'CSDB_Import', 'value' : 'YES' }, { 'attribute' : 'csdb_id', 'value' : row[0] } ] } ) print 'Created Enterprise#%d' % enterprise['objectId'] And I get an exception: Creating new 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_company.py", line 15, 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: The CSV file had the following contents: 401|TESTCOMPANY|www.testcompany.de|Testblah|ZIP||asdf|2|1|10|1|894900 Maybe I am completely wrong, and _CONTACTS are the persons associated to the company? I'm on a sles10sp1, using an ogo, about two or three months old. kind regards Sebastian From xmlrpc@opengroupware.org Thu Mar 27 12:26:53 2008 From: xmlrpc@opengroupware.org (Sebastian Reitenbach) Date: Thu, 27 Mar 2008 13:26:53 +0100 Subject: [OGo-XML-RPC] Re: questions regarding ZOGi, WAS: [OGo-Users]custom fields and synchronizing ogo Message-ID: <20080327122653.EF0EC85F71@smtp.l00-bugdead-prods.de> xmlrpc@opengroupware.org wrote: > Hi Adam, > > xmlrpc@opengroupware.org wrote: > > > I assume the two lines below the import line have to be on a single > line? > > > > yep. > > > > > Then I see a lot of, maybe only in my eyes, magic numbers, e.g.: > > > permissions = [ { 'operations' : 'rw', > > > 'targetObjectId' : 970990 }, > > > { 'operations' : 'rw', > > > 'targetObjectId' : 11530 } ] > > > are 11530 and 970990 object ID values of accounts or teams in ogo? > > > > Teams; these permissions "rw" for teams 970990 & 11530 are set on all > > imported values. Obviously that would be different or unnecessary > > depending on the site. They can be objectIds of accounts or teams. > > > > > then, a little bit later when creating the Enterprise: > > > ... > > > '_ACCESS' : permissions, > > > '_COMPANYVALUES' : [ { 'attribute' : 'division', > > > 'value' : 'WYC' }, > > > { 'attribute' : 'salesperson', > > > 'value' : row[0] }, > > > ... > > > I assume this will create all companies with a "division" attribute with > > > value WYC? > > > > Yep. > > > I took a look at the example scripts on the zogi wiki, and I am able to > create a company, also the extended attributes. I am having a problem > creating adding the contact_id to an enterprise. > > I took a look into the wiki, putObject examples, there you do sth like this: > > ... > person = {} > person['targetObjectId'] = 10160 > ... > enterprise['_CONTACTS'] = [ person ] > ... > enterprise = server.zogi.putObject(enterprise) > > > The script I use, is: > > #!/usr/bin/env python > # all intranet: 10003 > # > > import sys, csv, xmlrpclib, time > server = xmlrpclib.Server('http://admin:pw@localhost/zidestore/so/ogoroot') > permissions = [ { 'operations' : 'rw', > 'targetObjectId' : 10003 } ] > counter = 0 > reader = csv.reader(open("/root/bin/company.csv", "rb"), delimiter='|', > quoting=csv.QUOTE_NONE) > for row in reader: > print 'Creating new enterprise' > person = {} > person['targetObjectId'] = row[11] > enterprise = server.zogi.putObject( > { 'objectId' : 0, > 'entityName' : 'Enterprise', > 'name' : row[1], > 'url' : row[2], > '_ADDRESSES' : [ { 'name1' : row[1], > 'street' : row[3], > 'city' : row[6], > 'state' : row[5], > 'zip' : row[4], > 'type' : 'ship' } ], > '_ACCESS' : permissions, > '_CONTACTS' : person, > '_COMPANYVALUES' : [ { 'attribute' : 'contact_segments', > 'value' : row[7] }, > { 'attribute' : 'contact_markets', > 'value' : row[8] }, > { 'attribute' : 'country', > 'value' : row[9] }, > { 'attribute' : 'continent', > 'value' : row[10] }, > { 'attribute' : 'CSDB_Import', > 'value' : 'YES' }, > { 'attribute' : 'csdb_id', > 'value' : row[0] } > ] } > ) > print 'Created Enterprise#%d' % enterprise['objectId'] > > And I get an exception: > > Creating new 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_company.py", line 15, 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: (instance) does not recognize objectForKey: {\n methodName > = "zogi.putObject";\n methodParameters = (\n > {\n "_ACCESS" = (\n {\n > operations = rw;\n targetObjectId = 10003; > \n }\n );\n "_ADDRESSES" = (\n > > {\n city = asdf;\n name1 = > TESTCOMPANY;\n state = "";\n street = > Testblah;\n type = ship;\n zip = ZIP; > \n }\n );\n "_COMPANYVALUES" = (\n > > {\n attribute = "contact_segments";\n > value = 2;\n },\n {\n > attribute = "contact_markets";\n value = 1; > \n },\n {\n attribute = > country;\n value = 10;\n },\n > {\n attribute = continent;\n value = > 1;\n },\n {\n attribute > = "CSDB_Import";\n value = YES;\n },\n > > {\n attribute = "csdb_id";\n value = > 401;\n }\n );\n "_CONTACTS" = {\n > > targetObjectId = 894900;\n };\n entityName = > Enterprise;\n name = TESTCOMPANY;\n objectId = 0;\n > > url = "www.testcompany.de";\n }\n );\n}'> > > > The CSV file had the following contents: > 401|TESTCOMPANY|www.testcompany.de|Testblah|ZIP||asdf|2|1|10|1|894900 > > Maybe I am completely wrong, and _CONTACTS are the persons associated to the > company? when I want to update an existing record, I use the same script as above, but I specify an existing objectId, I get the following exception: /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 15, 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: Below the zidestore log when running with PGDebuggingEnabled YES: Mar 27 12:19:34 ogo-zidestore-1.5 [20522]: PG0x0x1045648 SQL: BEGIN TRANSACTION Mar 27 12:19:34 ogo-zidestore-1.5 [20522]: PG0x0x1045648 SQL: SELECT t1.account, t1.anniversary, t1.assistant_name, t1.associated_categories, t1.associated_company, t1.associated_contacts, t1.bank, t1.bank_code, t1.birthday, t1.boss_name, t1.company_id, t1.contact_id, t1.db_status, t1.department, t1.description, t1.dir_server, t1.email, t1.email_alias, t1.fileas, t1.firstname, t1.freebusy_url, t1.im_address, t1.is_customer, t1.is_enterprise, t1.is_private, t1.is_readonly, t1.keywords, t1.login, t1.name_affix, t1.name_title, t1.number, t1.object_version, t1.occupation, t1.office, t1.owner_id, t1.partner_name, t1.priority, t1.sensitivity, t1.show_email2_as, t1.show_email3_as, t1.show_email_as, t1.source_url, t1.url FROM enterprise t1 WHERE t1.company_id = 178630 Mar 27 12:19:34 ogo-zidestore-1.5 [20522]: PG0x0x1045648 SQL: SELECT DISTINCT t1.attribute, t1.company_id, t1.company_value_id, t1.db_status, t1.is_enum, t1.is_label_localized, t1.label, t1.type, t1.uid, t1.value_string FROM company_value t1 WHERE t1.company_id IN (178630) Mar 27 12:19:34 ogo-zidestore-1.5 [20522]: PG0x0x1045648 SQL: SELECT DISTINCT t1.company_id, t1.db_status, t1.info, t1.number, t1.real_number, t1.telephone_id, t1.type, t1.url FROM telephone t1 WHERE t1.company_id IN (178630) Mar 27 12:19:34 ogo-zidestore-1.5 [20522]: PG0x0x1045648 SQL: SELECT DISTINCT t1.comment, t1.company_id, t1.company_info_id, t1.db_status FROM company_info t1 WHERE t1.company_id IN (178630) Mar 27 12:19:34 ogo-zidestore-1.5 [20522]: PG0x0x1045648 SQL: ROLLBACK TRANSACTION The last statement before the ROLLBACK produces: SELECT DISTINCT t1.comment, t1.company_id, t1.company_info_id, t1.db_status FROM company_info t1 WHERE t1.company_id IN (178630); comment | company_id | company_info_id | db_status ---------+------------+-----------------+----------- | 178630 | 178640 | inserted What can I do about the version? > > I'm on a sles10sp1, using an ogo, about two or three months old. > kind regards Sebastian From xmlrpc@opengroupware.org Thu Mar 27 13:08:29 2008 From: xmlrpc@opengroupware.org (Sebastian Reitenbach) Date: Thu, 27 Mar 2008 14:08:29 +0100 Subject: [OGo-XML-RPC] Re: questions regarding ZOGi, WAS: [OGo-Users]custom fields and synchronizing ogo Message-ID: <20080327130830.993FF8600A@smtp.l00-bugdead-prods.de> xmlrpc@opengroupware.org wrote: > Hi Adam, > > xmlrpc@opengroupware.org wrote: > > > I assume the two lines below the import line have to be on a single > line? > > > > yep. > > > > > Then I see a lot of, maybe only in my eyes, magic numbers, e.g.: > > > permissions = [ { 'operations' : 'rw', > > > 'targetObjectId' : 970990 }, > > > { 'operations' : 'rw', > > > 'targetObjectId' : 11530 } ] > > > are 11530 and 970990 object ID values of accounts or teams in ogo? > > > > Teams; these permissions "rw" for teams 970990 & 11530 are set on all > > imported values. Obviously that would be different or unnecessary > > depending on the site. They can be objectIds of accounts or teams. > > > > > then, a little bit later when creating the Enterprise: > > > ... > > > '_ACCESS' : permissions, > > > '_COMPANYVALUES' : [ { 'attribute' : 'division', > > > 'value' : 'WYC' }, > > > { 'attribute' : 'salesperson', > > > 'value' : row[0] }, > > > ... > > > I assume this will create all companies with a "division" attribute with > > > value WYC? > > > > Yep. > > > I took a look at the example scripts on the zogi wiki, and I am able to > create a company, also the extended attributes. I am having a problem > creating adding the contact_id to an enterprise. > > I took a look into the wiki, putObject examples, there you do sth like this: > > ... > person = {} > person['targetObjectId'] = 10160 > ... > enterprise['_CONTACTS'] = [ person ] > ... > enterprise = server.zogi.putObject(enterprise) > > > The script I use, is: > > #!/usr/bin/env python > # all intranet: 10003 > # > > import sys, csv, xmlrpclib, time > server = xmlrpclib.Server('http://admin:pw@localhost/zidestore/so/ogoroot') > permissions = [ { 'operations' : 'rw', > 'targetObjectId' : 10003 } ] > counter = 0 > reader = csv.reader(open("/root/bin/company.csv", "rb"), delimiter='|', > quoting=csv.QUOTE_NONE) > for row in reader: > print 'Creating new enterprise' > person = {} > person['targetObjectId'] = row[11] > enterprise = server.zogi.putObject( > { 'objectId' : 0, > 'entityName' : 'Enterprise', > 'name' : row[1], > 'url' : row[2], > '_ADDRESSES' : [ { 'name1' : row[1], > 'street' : row[3], > 'city' : row[6], > 'state' : row[5], > 'zip' : row[4], > 'type' : 'ship' } ], > '_ACCESS' : permissions, > '_CONTACTS' : person, > '_COMPANYVALUES' : [ { 'attribute' : 'contact_segments', > 'value' : row[7] }, > { 'attribute' : 'contact_markets', > 'value' : row[8] }, > { 'attribute' : 'country', > 'value' : row[9] }, > { 'attribute' : 'continent', > 'value' : row[10] }, > { 'attribute' : 'CSDB_Import', > 'value' : 'YES' }, > { 'attribute' : 'csdb_id', > 'value' : row[0] } > ] } > ) > print 'Created Enterprise#%d' % enterprise['objectId'] > After reading about assignments in the Wiki, I changed the script, so that it looks like this: '_ACCESS' : permissions, '_CONTACTS' : [ { 'targetObjectId' : row[11] } ], '_COMPANYVALUES' : [ { 'attribute' : 'contact_segments', Now, the exception is gone, and the entry is created, but the contact_id field in the database is still empty. > > The CSV file had the following contents: > 401|TESTCOMPANY|www.testcompany.de|Testblah|ZIP||asdf|2|1|10|1|894900 > kind regards Sebastian From xmlrpc@opengroupware.org Thu Mar 27 15:05:19 2008 From: xmlrpc@opengroupware.org (Adam Tauno Williams) Date: Thu, 27 Mar 2008 11:05:19 -0400 Subject: [OGo-XML-RPC] Re: questions regarding ZOGi, WAS: [OGo-Users]custom fields and synchronizing ogo In-Reply-To: <20080327130830.993FF8600A@smtp.l00-bugdead-prods.de> References: <20080327130830.993FF8600A@smtp.l00-bugdead-prods.de> Message-ID: <1206630319.4885.30.camel@WM_ADAM1.morrison.iserv.net> > After reading about assignments in the Wiki, I changed the script, so that > it looks like this: > '_ACCESS' : permissions, > '_CONTACTS' : [ { 'targetObjectId' : row[11] } ], > '_COMPANYVALUES' : [ { 'attribute' : 'contact_segments', > Now, the exception is gone, and the entry is created, So the enterprise is created and the specified contact appears linked to the enterprise? That is what is supposed to happen. > but the contact_id field in the database is still empty. ??? Don't understand. The contact_id isn't related to contact<->enterprise assignment. In fact, I don't really have any idea what the purpose of the contact_id field is. Enterprise<->Contact relationships are records in the company_assignment table. Enterprise<->Contact is a [potentially] many:many relationship. I think a contactId is available in late version of zOGI's Contact entity, and it is the value of contact_id. But, again, don't know its intended purpose. > > The CSV file had the following contents: > > 401|TESTCOMPANY|www.testcompany.de|Testblah|ZIP||asdf|2|1|10|1|894900 From xmlrpc@opengroupware.org Thu Mar 27 15:25:17 2008 From: xmlrpc@opengroupware.org (Helge Hess) Date: Thu, 27 Mar 2008 16:25:17 +0100 Subject: [OGo-XML-RPC] Re: questions regarding ZOGi, WAS: [OGo-Users]custom fields and synchronizing ogo In-Reply-To: <1206630319.4885.30.camel@WM_ADAM1.morrison.iserv.net> References: <20080327130830.993FF8600A@smtp.l00-bugdead-prods.de> <1206630319.4885.30.camel@WM_ADAM1.morrison.iserv.net> Message-ID: On 27.03.2008, at 16:05, Adam Tauno Williams wrote: > In fact, I don't really have any idea > what the purpose of the contact_id field is. Its just an arbitary account which is considered the 'primary customer contact' associated with the given contact record. You can set this in the person/company editor. Greets, Helge -- Helge Hess http://www.helgehess.eu/ From xmlrpc@opengroupware.org Thu Mar 27 15:40:55 2008 From: xmlrpc@opengroupware.org (Sebastian Reitenbach) Date: Thu, 27 Mar 2008 16:40:55 +0100 Subject: [OGo-XML-RPC] Re: questions regarding ZOGi, WAS:[OGo-Users]custom fields and synchronizing ogo Message-ID: <20080327154055.BF998860A6@smtp.l00-bugdead-prods.de> xmlrpc@opengroupware.org wrote: > > After reading about assignments in the Wiki, I changed the script, so that > > it looks like this: > > '_ACCESS' : permissions, > > '_CONTACTS' : [ { 'targetObjectId' : row[11] } ], > > '_COMPANYVALUES' : [ { 'attribute' : 'contact_segments', > > Now, the exception is gone, and the entry is created, > > So the enterprise is created and the specified contact appears linked to > the enterprise? That is what is supposed to happen. > > > but the contact_id field in the database is still empty. No, the contact_id field stays empty, and also in the webinterface, there is no contact for the created company. > > ??? Don't understand. The contact_id isn't related to > contact<->enterprise assignment. In fact, I don't really have any idea > what the purpose of the contact_id field is. Enterprise<->Contact > relationships are records in the company_assignment table. > Enterprise<->Contact is a [potentially] many:many relationship. No, in the webinterface, when I edit an enterprise, then I can only assign one contact, it is a radio button selection. I just tried, and when I set a contact in the webui, then it takes the company_id from the account, and fills this company_id in the contact_id field in the company record. With Contact in this case, I mean an account, not a person from the contacts database. There I know, I have the many:many relationship as you describe. > > I think a contactId is available in late version of zOGI's Contact > entity, and it is the value of contact_id. But, again, don't know its > intended purpose. does that mean, only in the zogi source from google, or will it also be in the sources bundled with ogo? kind regards Sebastian From xmlrpc@opengroupware.org Thu Mar 27 17:47:22 2008 From: xmlrpc@opengroupware.org (Adam Tauno Williams) Date: Thu, 27 Mar 2008 13:47:22 -0400 Subject: [OGo-XML-RPC] Re: questions regarding ZOGi, WAS:[OGo-Users]custom fields and synchronizing ogo In-Reply-To: <20080327154055.BF998860A6@smtp.l00-bugdead-prods.de> References: <20080327154055.BF998860A6@smtp.l00-bugdead-prods.de> Message-ID: <1206640042.4885.51.camel@WM_ADAM1.morrison.iserv.net> > > So the enterprise is created and the specified contact appears linked to > > the enterprise? That is what is supposed to happen. > > > but the contact_id field in the database is still empty. > No, the contact_id field stays empty, and also in the webinterface, there is > no contact for the created company. Ah. Nope, it doesn't set the contact_id attribute on the Enterprise, it just does an assignment. 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). > > ??? Don't understand. The contact_id isn't related to > > contact<->enterprise assignment. In fact, I don't really have any idea > > what the purpose of the contact_id field is. Enterprise<->Contact > > relationships are records in the company_assignment table. > > Enterprise<->Contact is a [potentially] many:many relationship. > No, in the webinterface, when I edit an enterprise, then I can only assign > one contact, it is a radio button selection. Ok, that is different than assignments. > > I think a contactId is available in late version of zOGI's Contact > > entity, and it is the value of contact_id. But, again, don't know its > > intended purpose. > does that mean, only in the zogi source from google, or will it also be in > the sources bundled with ogo? Nope, it should work to set contactId in either version. zOGI stores attributes as-is unless specific renaming or value mangling is in place (such as translating attribute names; objectId becomes companyId, etc...) From xmlrpc@opengroupware.org Fri Mar 28 08:35:00 2008 From: xmlrpc@opengroupware.org (Sebastian Reitenbach) Date: Fri, 28 Mar 2008 09:35:00 +0100 Subject: [OGo-XML-RPC] Re: questions regarding ZOGi,WAS:[OGo-Users]custom fields and synchronizing ogo Message-ID: <20080328083501.91690D0BE3@smtp.l00-bugdead-prods.de> xmlrpc@opengroupware.org wrote: > > > So the enterprise is created and the specified contact appears linked to > > > the enterprise? That is what is supposed to happen. > > > > but the contact_id field in the database is still empty. > > No, the contact_id field stays empty, and also in the webinterface, there is > > no contact for the created company. > > Ah. Nope, it doesn't set the contact_id attribute on the Enterprise, > it just does an assignment. ah, yeah, it assigned the account to the company. I found the account added to the persons tab of the company. > > 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? cheers Sebastian Sebastian From xmlrpc@opengroupware.org Fri Mar 28 11:05:43 2008 From: xmlrpc@opengroupware.org (Adam Tauno Williams) Date: Fri, 28 Mar 2008 07:05:43 -0400 Subject: [OGo-XML-RPC] Re: questions regarding ZOGi,WAS:[OGo-Users]custom fields and synchronizing ogo In-Reply-To: <20080328083501.91690D0BE3@smtp.l00-bugdead-prods.de> References: <20080328083501.91690D0BE3@smtp.l00-bugdead-prods.de> Message-ID: <1206702343.19517.18.camel@aleph> > > 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. You shouldn't need to bump the version number, the version number needs to be equal to the version on the server. /* 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 */ From xmlrpc@opengroupware.org Fri Mar 28 11:28:43 2008 From: xmlrpc@opengroupware.org (Sebastian Reitenbach) Date: Fri, 28 Mar 2008 12:28:43 +0100 Subject: [OGo-XML-RPC] Re: questions regardingZOGi,WAS:[OGo-Users]custom fields and synchronizing ogo Message-ID: <20080328112843.CEA8CD0C74@smtp.l00-bugdead-prods.de> xmlrpc@opengroupware.org 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: specifying the flag, "fixes" the problem for me. > > > /* 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 */ > thanks a lot Sebastian From xmlrpc@opengroupware.org Fri Mar 28 12:49:59 2008 From: xmlrpc@opengroupware.org (Adam Tauno Williams) Date: Fri, 28 Mar 2008 08:49:59 -0400 Subject: [OGo-XML-RPC] Re: questions regardingZOGi,WAS:[OGo-Users]custom fields and synchronizing ogo In-Reply-To: <20080328112843.CEA8CD0C74@smtp.l00-bugdead-prods.de> References: <20080328112843.CEA8CD0C74@smtp.l00-bugdead-prods.de> Message-ID: <1206708599.4938.10.camel@WM_ADAM1.morrison.iserv.net> > > 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: > xmlrpclib.Fault: > specifying the flag, "fixes" the problem for me. Ah, so it is working perfectly. :) Unless you specify the ignoreVersion flag you should get a "HTTP 500: Client object is out of date" unless the version number of the presented entity is the *same* as the version number of the server object. This ensures that you aren't updating the data of an object that has changed since you looked at it [via a getObject or whatever]. For bulk loads it doesn't much matter, hence the "ignoreVersion" flag, but I strongly encourage actual applications to handle object versions otherwise you get a last-writer-wins scenario and the concomitant potential data loss. The getObjectVersionsById method exists to allow an application a bulk method of simply scanning it's cache for out-of-date objects. Then you can update what you can and provide the user with a list of conflicting objects and allow them to decide how to proceed. From xmlrpc@opengroupware.org Fri Mar 28 16:04:24 2008 From: xmlrpc@opengroupware.org (Helge Hess) Date: Fri, 28 Mar 2008 17:04:24 +0100 Subject: [OGo-XML-RPC] Re: questions regardingZOGi,WAS:[OGo-Users]custom fields and synchronizing ogo In-Reply-To: <1206708599.4938.10.camel@WM_ADAM1.morrison.iserv.net> References: <20080328112843.CEA8CD0C74@smtp.l00-bugdead-prods.de> <1206708599.4938.10.camel@WM_ADAM1.morrison.iserv.net> Message-ID: On 28.03.2008, at 13:49, Adam Tauno Williams wrote: > Ah, so it is working perfectly. :) Unless you specify the > ignoreVersion > flag you should get a "HTTP 500: Client object is out of date" HTTP 500 is kinda incorrect for that case, 409 (Conflict) should be appropriate. Though for XML-RPC one might want to return 200 and an XML fault object. Greets, Helge -- Helge Hess http://www.helgehess.eu/