[Zope] Need help with authentication through XML-RPC
I-Min Mau
imin@egenius.com
Sun Dec 22 22:52:21 CET 2013
Hi More experienced Zope folks,
I am a fairly raw programming intern who have been learning Zope and
Python. Now here's my problem:
I have set up a DTML method in a folder that'll create a DA note
(DigitalAccess Note product) object in that folder. I have tried it locally
and it works. Even better, is it can be invoked via http request through my
web browser remotely, and everything is fine,
the User Authentication dialog box is brought up automatically, and I can
enter my userId and password and all works.
**BUT how to I do the same trick with XML-RPC? I have done some
minimalistic XML-RPCs using the xmlrpclib module created by F.Lundh, but now
I ran into the real problem:
his module as is does not come with support for sending requests with basic
authentication
and needs to be extended! (SEE "How to use XML-RPC with Zope" by Mr. Amos
at http://www.zope.org/Members/Amos/XML-RPC ) In that article, the author
does offer ONE example code on how to extended this via addition of a
BasicAuthTransport class. And here's what I have tried to do to make this
work:
1. copied the xmlrpclib module into another module "xmlrpclibx.py" so I
can play with it safely..
2. make sure the string and httplib were imported (if they weren't I
added the statement in at the beginning)
3. copied the class definition of BasicAuthTransport class into this
module, with only one change: instead of xmlrpclib.Transport the first line
parameter is just Transport)
4. made one change in the class Server definition (that calls the
Transport functions)
where it says: if transport is None:
transport = Transport()
self.__transport = transport
I changed the middle statement to: transport =
BasicAuthTransport() in order to
try to get the modified method called.
Then I just discovered that in BasicAuthTransport codes there's a NameError
with "encodestring" (that's NOT defined in string module). And as it
stands, I have attempted to replace that block with what I think would be
the string involved, only to see that, when I execute that call, I don't get
ANY feedback-the DOS prompt simply "stalled"-nothing was done,as if the
program ran into the Abyss..
Help! Someone! What should I do? Thanks and happy Holidays
I-Min
More information about the Zope
mailing list