SimpleXMLRPCServer question

Hendrik van Rooyen mail at microcorp.co.za
Sun Feb 1 03:38:53 EST 2009


 "flagg" <iana...04 at gmail.com> wrote:


>Let me see if i can elaborate on the requirements.  I have 20+
>different zone files.  I want the xmlrpc server to be able to
>determine what zone file to open by looking at the incoming xml
>request.  For example one of the functions I have now is to show a DNS
>record (I am using dnspython for most of this work)
>

This is a wrong move, it is too magical - see below

>If i send an xmlrpc request that uses the 'showRecord' function with
>params of 'oracle1.foo.bar.com'  I want to parse the "params" piece
>and then instruct the xml-rpc server to open foo.bar.com.zone for
>reading.  The reason why i was looking at do_Post() and _dispatch was
>to attempt to read the incoming params and do exactly that.
>
>Do you think there is an easier way of accomplishing this, than the
>way I am going about it?

Yes I do.

Why don't you split the functionality into two bits - exactly as if you were
doing
it locally:

- OpenTheThing(whatOrWhere)
- ReadTheRecordAndShowIt(PossiblyWhichRecord)

If it's a remote database you are accessing, then you may need even more
steps, like first doing some select, or whatever - I would get it running
locally, calling local functions directly on the server, and then make them
remote xmlrpc proxy functions, after it's all working.

If you are getting the request from some user input, you can either change
the way you ask the questions, or you do the parsing at point of origen, to
determine what to call, in which sequence.

- Hendrik






More information about the Python-list mailing list