No, I think you've misunderstood because while I thought I was being clear I probably was not. So here is the complete code of create_edit_passengers3.py:<br><br>#!/usr/bin/python<br><br>import cgitb; cgitb.enable()<br>
import cgi<br>import sys,os<br>sys.path.append(os.getcwd())<br>import MySQLdb<br>from login import login<br>import fpformat<br>from New_Passengers_Curr_Customers import New_Passengers_Curr_Customers<br>from New_Passengers_Addl_Customers import New_Passengers_Addl_Customers<br>
from New_Passenger import New_Passenger<br><br>form = cgi.FieldStorage()<br><br>def sortedDictValues(adict):<br> items = adict.items()<br> items.sort()<br> return [value for key, value in items]<br><br>def create_edit_passengers3():<br>
print "Content-Type: text/html"<br> print<br> print '''<br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd</a>"><br>
<head xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>"><br></head><br><body><br>'''<br> user, passwd, db, host = login()<br> database = MySQLdb.connect(host, user, passwd, db)<br>
cursor = database.cursor()<br> cursor.execute('select id from Flights;')<br> flights = [itm[0] for itm in cursor]<br> cursor.execute('select id, first_name, middle_name, last_name, suffix from Customers;')<br>
customers = cursor.fetchall()<br> try:<br> cursor.execute('select <a href="http://p.id">p.id</a>, c.first_name, c.middle_name, c.last_name, c.suffix, c.discount, p.flights_id, <a href="http://p.name">p.name</a>, f.price, <a href="http://c.id">c.id</a> from Customers c join Passengers p on <a href="http://c.id">c.id</a>=p.customer_id join Flights f on p.flights_id=<a href="http://f.id">f.id</a>;')<br>
passengers = cursor.fetchall()<br> print '<form method="post" action="create_edit_passengers4.py">\n'<br> start_html = "<table border='2'>\n <tr>\n <td><b>Delete?</b></td>\n <td><b>Flight</b></td>\n <td><b>Name</b></td>\n <td><b>Discount</b></td>\n <td><b>Price</b></td>\n </tr>\n"<br>
passengers_html = []<br> ids = []<br> i = 0<br> for passenger in passengers:<br> do_delete = form.getfirst('%s:delete' % passenger[0])<br> New_Passenger(passenger, do_delete)<br> printHTML = sortedDictValues(dict(zip(ids, passengers_html)))<br>
if len(printHTML) > 0:<br> print start_html<br> for html in printHTML:<br> print html<br> print "</table>"<br> except MySQLdb.ProgrammingError:<br> pass<br> New_Passengers_Curr_Customers(customers, flights, new_passengers_curr_customers)<br>
new_passengers_addl_customers = int(form.getfirst('new_passengers_addl_customers', 0))<br> New_Passengers_Addl_Customers(customers, flights, new_passengers_addl_customers)<br> if (new_passengers_addl_customers > 0) or (new_passengers_curr_customers > 0):<br>
print "<input type='submit' value=' Send ' />"<br> print '</body>\n</html>'<br> cursor.close()<br><br>create_edit_passengers3()<br><br><br><br>Now, create_edit_passengers3() is called by the form/submit button in (you guessed it) create_edit_passengers2.py, the latter containing a var in it which *should* be accessible to create_edit_passengers3.py, one would think. *However*, if I put the following line in create_edit_passengers3.py (even in the beginning outside the fn of the same name):<br>
<br> new_passengers_curr_customers =
int(form.getfirst('new_passengers_curr_customers', 0))<br><br>the value will *always* be 0. *However*, if I put that *same_line* of code in New_Passengers.py (and fn of same name). it will give me the correct value, which I can then pass back to the calling script (create_edit_passengers3.py). Can you explain to me why it would behave like that? I've never had a problem like this before and I've worked with accessing variables by this manner in many a script.<br>
TIA,<br>beno<br>