On Wed, 2006-01-18 at 20:51 +0100, Alejandro Martínez Marcos wrote:
> Hello,
>
> we have an application based on OpenGroupware XML-RPC
> interface that sets and gets contacts, appointments and tasks on Ogo.
> We are using OpenGroupware version OGo-1.0beta.1-r1175.0. We are
> unable to create appointments at all, though all the rest of the
> operations we need work fine The result is always the same:
>
> xmlrpclib.Fault: <Fault 0: 'LSDBObjectCommandException:
> appointment::new failed: no participants set !'>
>
> But the appointment I have prepared does contain participants.
I just looked at my POGI code, and to change the participants of an
appointment you need to call appointment.setParticipants, for instance
we have a method like -
function setParticipants($_ap) {
$this->traceMessage('@OGoAppointmentManager:setParticipants');
$list = array();
foreach($_ap->getParticipants() as $participant)
array_push($list, new XML_RPC_Value($participant->getShortId(),
"string"));
$params = array(new XML_RPC_Value($_ap->getShortId(), "string"),
new XML_RPC_Value($list, "array"));
$response = $this->server->rpc_call('appointment.setParticipants',
$params);
list($quality, $content) = $this->server->result_value($response);
return $quality;
}
- where _ap is an appointment object. This gathers the participant
subkeys off the appointment object and submits them to setParticipants.
So for a new appointment: (1) create the appointment [ the response in
an appointment object ] then (2) add participants and call
setParticipants. For an existing appointment (1) request the
appointment (2) add/remove participants (3) call setParticipants
> This is a very simple python script that I have tried, I see
> everything correct in it:
> #!/usr/bin/env python
> import xmlrpclib
> server = xmlrpclib.Server('http://.../RPC2',login='user1',password='...')
> import xmlrpclib,time
> dateStringStart = "20040116T10:10:10"
> dateStringEnd = "20040116T11:15:10"
> startDate =
> xmlrpclib.DateTime(time.mktime(time.strptime(dateStringStart,"%Y%m%dT%H:%M:%S")))
> endDate =
> xmlrpclib.DateTime(time.mktime(time.strptime(dateStringEnd,"%Y%m%dT%H:%M:%S")))
> print startDate
> print endDate
> dict = {}
> dict['startDate'] = startDate
> dict['endDate'] = endDate
> dict['title'] = 'Cita1'
> # We search for a participant, myself
> person=server.person.fetch("login like '*user1*'")
> print person
> dict['participants'] = person
> print dict
> result = server.appointment.insert(dict)
> print result
>
>
>
> And this is the result of the script:
>
> (These come from print startDate and print endDate:)
> <DateTime 20040116T10:10:10 at -481d2854>
> <DateTime 20040116T11:15:10 at -4827f6d4>
>
>
> (It comes from "print person")
> [{'extendedAttrs': {'email1': '...'}, 'number': 'OGo18010',
> 'addresses': {'mailing': {'type': 'mailing', 'id':
> 'skyrix://localhost.localdomain/localhost.localdomain/18050', 'name1':
> '...'}, 'location': {'type': 'location', 'id':
> 'skyrix://localhost.localdomain/localhost.localdomain/18060'},
> 'private': {'type': 'private', 'id':
> 'skyrix://localhost.localdomain/localhost.localdomain/18040'}},
> 'extendedKeys': ['email1', 'email2', 'email3', 'job_title',
> 'other_title1', 'other_title2'], 'url': '', 'phones':
> {'15_fax_private': {'telephoneId': 18120, 'info': '', 'type':
> '15_fax_private', 'number': ''}, '02_tel': {'telephoneId': 18080,
> 'info': '', 'type': '02_tel', 'number': ''}, '01_tel': {'telephoneId':
> 18070, 'info': '', 'type': '01_tel', 'number': ''}, '05_tel_private':
> {'telephoneId': 18100, 'info': '', 'type': '05_tel_private', 'number':
> ''}, '10_fax': {'telephoneId': 18110, 'info': '', 'type': '10_fax',
> 'number': ''}, '03_tel_funk': {'telephoneId': 18090, 'info': '',
> 'type': '03_tel_funk', 'number': ''}}, 'phoneTypes': ['01_tel',
> '02_tel', '03_tel_funk', '05_tel_private', '10_fax',
> '15_fax_private'], 'objectVersion': 3, 'isComplete': <Boolean True at
> -481dd4f4>, 'isPrivate': <Boolean False at -481dd4d4>, 'isAccount':
> <Boolean True at -481dd4f4>, 'owner': {'login': '...(my ogo root
> user)...', 'id':
> 'skyrix://localhost.localdomain/localhost.localdomain/10000'},
> 'login': 'user1', 'id':
> 'skyrix://localhost.localdomain/localhost.localdomain/18010', 'name':
> '...I'}]
>
>
>
>
> (It comes from "print dict")
> {'startDate': <DateTime 20040116T10:10:10 at -481d2854>,
> 'participants': [{'extendedAttrs': {'email1': 'test@xxxxxxx'},
> 'number': 'OGo18010', 'addresses': {'mailing': {'type': 'mailing',
> 'id': 'skyrix://localhost.localdomain/localhost.localdomain/18050',
> 'name1': '...'}, 'location': {'type': 'location', 'id':
> 'skyrix://localhost.localdomain/localhost.localdomain/18060'},
> 'private': {'type': 'private', 'id':
> 'skyrix://localhost.localdomain/localhost.localdomain/18040'}},
> 'extendedKeys': ['email1', 'email2', 'email3', 'job_title',
> 'other_title1', 'other_title2'], 'url': '', 'phones':
> {'15_fax_private': {'telephoneId': 18120, 'info': '', 'type':
> '15_fax_private', 'number': ''}, '02_tel': {'telephoneId': 18080,
> 'info': '', 'type': '02_tel', 'number': ''}, '01_tel': {'telephoneId':
> 18070, 'info': '', 'type': '01_tel', 'number': ''}, '05_tel_private':
> {'telephoneId': 18100, 'info': '', 'type': '05_tel_private', 'number':
> ''}, '10_fax': {'telephoneId': 18110, 'info': '', 'type': '10_fax',
> 'number': ''}, '03_tel_funk': {'telephoneId': 18090, 'info': '',
> 'type': '03_tel_funk', 'number': ''}}, 'phoneTypes': ['01_tel',
> '02_tel', '03_tel_funk', '05_tel_private', '10_fax',
> '15_fax_private'], 'objectVersion': 3, 'isComplete': <Boolean True at
> -481dd4f4>, 'isPrivate': <Boolean False at -481dd4d4>, 'isAccount':
> <Boolean True at -481dd4f4>, 'owner': {'login': '...(my root
> user)...', 'id':
> 'skyrix://localhost.localdomain/localhost.localdomain/10000'},
> 'login': 'user1', 'id':
> 'skyrix://localhost.localdomain/localhost.localdomain/18010', 'name':
> '...'}], 'endDate': <DateTime 20040116T11:15:10 at -4827f6d4>,
> 'title': 'Cita1'}
>
>
> And this is the exception, from "result = server.appointment.insert(dict):"
>
> Traceback (most recent call last):
> File "./crear_cita.con.participante.py", line 21, in ?
> result = server.appointment.insert(dict)
> File "/home/.../xmlrpclib.py", line 830, in __call__
> return self.__send(self.__name, args)
> File "/home/.../xmlrpclib.py", line 996, in __request
> verbose=self.__verbose
> File "/home/.../xmlrpclib.py", line 867, in request
> return self.parse_response(h.getfile())
> File "/home/.../xmlrpclib.py", line 916, in parse_response
> return u.close()
> File "/home/.../xmlrpclib.py", line 579, in close
> raise apply(Fault, (), self._stack[0])
> xmlrpclib.Fault: <Fault 0: 'LSDBObjectCommandException:
> appointment::new failed: no participants set !'>
>
> Do you see anything wrong in my script? Does exist any workaround?
>
> Thanks in advance,
>
> Alejandro Martínez
signature.asc
Description: This is a digitally signed message part
|