Hi,

Now I have another error. When I use the code of doc/examples/python-api.py
inside my server XML-RPC (not the ipa server) that configured like this :

== Server ==
--------- httpd conf ------------
<Files "xmlrpc">
  ## python conf


  # ....
  SetHandler python-program
  PythonHandler xmlrpchandler
  PythonDebug on
</Files>
------------------------------------

the handler xmlrpchandler calls the following method when the client
requests for the remote method getUserInfos().

--------- account.py ------------
def getUserInfos(user_name, env=None):

    from ipalib import api

    api.bootstrap_with_global_options(context='webservices')
    api.finalize()
    api.Backend.xmlclient.connect()
    return api.Command.user_show(user_name)
------------------------------------


== Client ==
Now when I call  this method from my client, I get this exception :

------------------------------------
<Fault 2: "account.getUserInfos: <type 'exceptions.StandardError'>:
API.bootstrap() already called">
------------------------------------

I don't know why it does not work, any ideas ??

Thanks,

2010/4/19 ALAHYANE Rachid <afk...@gmail.com>

> Thank you for your answer, it works !
>
> 2010/4/19 Jason Gerard DeRose <jder...@redhat.com>
>
> On Mon, 2010-04-19 at 16:22 +0200, ALAHYANE Rachid wrote:
>> > Hi,
>> >
>> >
>> > Using F12 with the alpha version of ipa, I want to know if there is
>> > some ways to call implemented methods like  user_show() with my own
>> > script python. My goal is to call these methods with a client xml-rpc
>> > that I will to developpe later.
>> >
>> >
>> > On my client, I tried this but it does not work :(
>>
>> It needs more documentation, but see doc/examples/python-api.py
>>
>> Let me know if that doesn't work or if you get stuck.  You will need to
>> do a kinit first.
>>
>> >
>> ----------------------------------------------------------------------------
>> > >>> from ipalib import api
>> > >>> api.bootstrap_with_global_options()
>> > (<Values at 0xb74f556c: {'debug': None, 'conf': None, 'env': None,
>> > 'verbose': None}>, [])
>> > >>> api.load_plugins()
>> > >>> api.finalize()
>> > >>> api.Method.user_show.__doc__
>> > '\n    Display user.\n    '
>> > >>> api.Method.user_show(u'raca')
>> > Traceback (most recent call last):
>> >   File "<stdin>", line 1, in <module>
>> >   File "/usr/lib/python2.6/site-packages/ipalib/frontend.py", line
>> > 398, in __call__
>> >     ret = self.run(*args, **options)
>> >   File "/usr/lib/python2.6/site-packages/ipalib/frontend.py", line
>> > 667, in run
>> >     return self.forward(*args, **options)
>> >   File "/usr/lib/python2.6/site-packages/ipalib/frontend.py", line
>> > 688, in forward
>> >     return self.Backend.xmlclient.forward(self.name, *args, **kw)
>> >   File "/usr/lib/python2.6/site-packages/ipalib/rpc.py", line 403, in
>> > forward
>> >     command = getattr(self.conn, name)
>> >   File "/usr/lib/python2.6/site-packages/ipalib/backend.py", line 96,
>> > in __get_conn
>> >     self.id, threading.currentThread().getName())
>> > AttributeError: no context.xmlclient in thread 'MainThread'
>> >
>> >
>> >
>> ----------------------------------------------------------------------------
>> >
>> >
>> > Have you any idea ? or some pertinent docs
>> >
>> >
>> > Sorry for my bad English :)
>> >
>> >
>> > --
>> > Meilleures salutations / Best Regards
>> >
>> > Rachid ALAHYANE
>> >
>> >
>> > _______________________________________________
>> > Freeipa-users mailing list
>> > Freeipa-users@redhat.com
>> > https://www.redhat.com/mailman/listinfo/freeipa-users
>>
>>
>
>
> --
> Meilleures salutations / Best Regards
>
> Rachid ALAHYANE
>
>


-- 
Meilleures salutations / Best Regards

Rachid ALAHYANE
_______________________________________________
Freeipa-users mailing list
Freeipa-users@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-users

Reply via email to