Re: [Tutor] Trying to use MySQLdb.cursor

2005-03-25 Thread Vicki Stanfield
>> below to print the data returned from my query, but I would like to > make >> labels at the top of the columns. How do I do this dynamically? > > You shouldn't, it makes your code very vulnarable to changes in the > database! > Its the same principle as using 'select * from...', a bad idea in >

[Tutor] Trying to use MySQLdb.cursor

2005-03-24 Thread Vicki Stanfield
I finally gave up and used MySQLdb to connect to my database. It connects okay, and returns data, but now I have a new question. I use the code below to print the data returned from my query, but I would like to make labels at the top of the columns. How do I do this dynamically? I would like to ge

[Tutor] Mysqldb module - where ?????

2005-03-24 Thread Vicki Stanfield
I am googling for a slackware package containing the Mysqldb module, but all I am coming up with is MySQLdb. I am not hallucinating right? They are indeed two separate modules? Vicki ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman

Re: [Tutor] Passing data from html to py

2005-03-23 Thread Vicki Stanfield
I have one last question on this particular script. I am using the following line to print out the post data: for key in form: print "%s: %s" % (key, form[key].value) It works fine except for when the key is to a list object made by the following select statement: Mother

[Tutor] Passing data from html to py

2005-03-23 Thread Vicki Stanfield
I am trying to understand how to pass data back and forth from a form to a python script. I mostly have it working now, but I am unsure about how to find out which variables are being passed from the html. I can see them in the form.list, but I need to iterate over them and print a label for each.

Re: [Tutor] Passing data from html to py

2005-03-23 Thread Vicki Stanfield
> > Hi Vicki --- > > Two things: > > Firstly, a there is a difference between /n and \n :-) > > Secondly, remember that all whitespace (including newlines) in HTML is > collapsed > down to a single space. > > The newlines will be there, but your web browser is just ignoring them. A > quick > fix i

Re: [Tutor] Getting error that calendar is underfined when importing calendar module

2005-03-23 Thread Vicki Stanfield
> The cgi is importing itself when you 'import calendar'. Try renaming your > calendar.py to something > else like calendar-cgi.py > > Kent Thanks. I was almost there, having noticed that dir(calendar) was different when run from the script than in an interactive session. Vicki P.S. Now to parse

[Tutor] Getting error that calendar is underfined when importing calendar module

2005-03-23 Thread Vicki Stanfield
Hi all. I am using Python 2.4 on a Slackware Linux box and am having a problem importing the calendar module into a program that I am writing. The code is simple and looks like this: import cgitb, os, sys cgitb.enable() sys.strerr = sys.stdout import cgi import time import calendar print "Conten

Re: [Tutor] Python cgi doesn't get data from html form as expected

2005-03-22 Thread Vicki Stanfield
> Please post the HTML for the form you are submitting and the HTML from a > View Source on the result. > > Kent Sorry to have bothered the list. I figured out the answer (sort of). I had parse the HTML code through an XHTML parser which removed all the name= leaving id= only. That doesn't work wi

Re: [Tutor] Python cgi doesn't get data from html form as expected

2005-03-22 Thread Vicki Stanfield
> I haven't done too much web stuff (or much of anything) with python, but > I looked into your question a bit (researching other's problems may help > me avoid them =)). A quick search brought up this page which seems to > have information which may help you. > > http://gnosis.cx/publish/programm

[Tutor] Python cgi doesn't get data from html form as expected

2005-03-22 Thread Vicki Stanfield
I have recently started doing cgi in Python and have run into a problem. I have an html form which has various widgets which accept data. I also have this in that html file: formdata.py runs but doesn't seem to contain the data from the form. I'm not sure of the format for the for with regard to