how do i map this?

ronrsr ronrsr at gmail.com
Sun Nov 12 22:11:21 EST 2006


I think I am passing the wrong argument to the Print_row routine:



Traceback (most recent call last):
  File "index.py", line 91, in ?
    zhtml.print_row(record)
  File "/usr/www/users/homebase/realprogress/zingers/zhtml.py", line
154, in pri
nt_row
    print """<tr>
TypeError: format requires a mapping
homebase at upsilon%



routine from zhtml.py:

#row is a dictionary with keys: zid, keywords, citation, quotation
def print_row(row):
   print """<tr>
      <td class="pad">%(keywords)s
      </td>
      <td class="pad">%(quotation)s
      </td>
      <td class="pad">%(citation)s
      </td>
      <td class="pad" align="center"><form action="update.py"
name="updateform" enctype="application/x-www-form-urlencoded"
method="GET"><input type="hidden" name="zid" value="%(zid)d"><input
type="submit" value="Edit"></form>
      </td>
      </tr>
      """


code from index.py:


cursor.execute(querystring);
# get the resultset as a tuple
result = cursor.fetchall()
# iterate through resultset
for record in result:
      print record[0] , "-->", record[1]

#zq = zc.query(querystring).dictresult()

#HTML

import zhtml
zhtml.print_start_html()
zhtml.print_header("Frankie's Zingers")

if form.has_key("printview"):
   print ("xxxxthenxxxxxx")
   zhtml.printp_start_table()
   zhtml.printp_title_row()
   for record in result:
      zhtml.printp_row(record[row])
else:
#   print ("xxxxxelsexxxxx",record[1]);
   zhtml.print_top_controls(k=k,c=c,q=q)
   zhtml.print_start_table()
   zhtml.print_title_row()
   zhtml.print_search_row(k=k,c=c,q=q)
   for record in result:


      print(record);
      zhtml.print_row(record)

zhtml.print_end_table()
zhtml.print_end_html()






how do i go about mapping that, if tha'ts what I need to do.
thanks again for your help.

bests, 

-rsr-




More information about the Python-list mailing list