views:

366

answers:

1

What is a good/simple way to create, say a five page wizard, in Python, where the web server component composes the wizard page content mostly dynamically by fetching the data via calls to a XML-RPC back-end. I have experienced a bit with the XML-RPC Python module, but I don't know which Python module would be providing the web server, how to create the static content for the wizard and I don't know how to extend the web server component to make the XML-RPC calls from the web server to the XML-RPC back-end to be able to create the dynamic content.

+3  A: 

If we break down to the components you'll need, we get:

  1. HTTP server to receive the request from the clients browser.
  2. A URL router to look at the URL sent from client browser and call your function/method to handle that URL.
  3. An XML-RPC client library to fetch the data for that URL.
  4. A template processor to render the fetched data into HTML.
  5. A way to send the rendered HTML as a response back to the client browser.

These components are handled by almost all, if not all, Python web frameworks. The XML-RPC client might be missing, but you can just use the standard Python module you already know.

Django and Pylons are well documented and can easily handle this kind of project, but they will also have a lot of stuff you won't need. If you want very easy and absolute minimum take a look at using juno, which was just released recently and is getting some buzz.

These frameworks will handle #1 and provide a way for you to specify #2, so then you need to write your function/method that handles the incoming request (in Django this is called a 'view').

All you would do is fetch your data via XML-RPC, populate a dictionary with that data (in Django this dictionary is referred to as 'context') and then render a template from the context into HTML by calling the template engine for that framework.

Your function will just return the HTML to the framework which will then format it properly as an HTTP response and send it back to the client browser.

Simple!

UPDATE: Here's a description of how to do wizard style multiple-step forms in Django that should help you out.

Van Gale
+1: Get a framework. Add CherryPy to the list with Django a Pylons. It's pretty nice for very simple things.
S.Lott