[Tutor] study advice on javascript to python hand-off

Serdar Tumgoren zstumgoren at gmail.com
Thu Aug 14 16:41:35 CEST 2008


Hi everyone,

I've been trying to tackle a certain data-entry and processing problem for
quite some time, and I was wondering if someone could offer advice on the
path I should take. Whatever the answer, I know I have a great deal of study
ahead of me, but I was hoping to at least narrow the field.

My specific use-case involves an attempt to create a web-based phone
contacts system that allows users to associate a single contact with one or
more business entities (or phone numbers or relatives, etc.). On the backend
database, I know this requires the use of a linking table and a many-to-many
relationship between tables for "individuals" and "businesses."

The front end is where I'm running aground.

Ideally, I'd like to have a data entry/edit form that lets the client-side
user associate multiple entities with a contact before submitting the form
to the server.

So if the user enters "John Smith" as a contact, they can initially
associate him with "ABC Company".
If John Smith also serves on the board of directors for XYZ Foundation, I'd
like to let the user click an Add button to also associate John Smith with
the foundation. All of this should take place before the form is submitted
back to the server.

A simple javascript implementation of the add/remove functionality I'm
speaking of can be found at
http://www.dustindiaz.com/add-remove-elements-reprise.

The part I'm getting lost on is how to take those dynamic user-generated
values and get at them on the server side using python, with the end-goal of
parsing and adding the values to the appropriate database tables (I expect
I'll also have to do plenty of validation and checking for possible
duplicates, but I'm waving my hand at those issues for the moment).

So I was hoping someone could explain how to accomplish this seeming
hand-off from client-side javascript to server-side python.

Should I be accessing the DOM? And if so, should I be parsing URLs or using
xml (e.g. python's xml.dom API or Frederick Lundh's ElementTree module)?

I suspect that I may be misusing/confusing the terminology here, so please
feel free to point out any mistakes. Or perhaps I'm over-complicating the
issue and there's a simpler solution to what I'm trying to accomplish.

If someone could suggest a conceptual approach to the problem, and even
point to some good readings that tie these elements together for the stated
purpose, I'd be greatly indebted.

Regards,

Serdar T.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080814/91f147e9/attachment.htm>


More information about the Tutor mailing list