Changeset 11427 in genesis


Ignore:
Timestamp:
Aug 30, 2012, 7:15:29 AM (12 years ago)
Author:
rick
Message:

Now also print the header if you generate it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r11426 r11427  
    11351135
    11361136  # Update repository if requested
    1137   form = urlparse.parse_qs(environ['QUERY_STRING'])
    1138   if form.has_key("action") and "update" in form["action"]:
     1137  form = urlparse.parse_qs(environ['QUERY_STRING']) if environ.has_key('QUERY_STRING') else None
     1138  if form and form.has_key("action") and "update" in form["action"]:
    11391139    output = "[INFO] Updating subverion, please wait...\n"
    11401140    output += subprocess.Popen(['svn', 'cleanup', "%s/.." % NODE_DIR], stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0]
     
    14541454      print "#ERROR: '%s' is invalid input (left, right, edit or ignore)!" % c
    14551455
     1456
     1457
     1458def print_cgi_response(response_headers, output):
     1459  """Could we not use some kind of wsgi wrapper to make this output?"""
     1460  for header in response_headers:
     1461     print "%s: %s" % header
     1462  print "\n"
     1463  print output
     1464
     1465
     1466
    14561467def main():
    14571468  """Hard working sub"""
     
    15151526      os.environ['PATH_INFO'] = "/".join(sys.argv[2:])
    15161527      os.environ['SCRIPT_NAME'] = __file__
    1517       process_cgi_request()
     1528      response_headers, output = process_cgi_request()
     1529      print_cgi_response(response_headers, output)
    15181530    elif sys.argv[1] == "static":
    15191531      items = dict()
     
    18691881    if not is_text_request():
    18701882      cgitb.enable()
    1871     process_cgi_request()
     1883    response_headers, output = process_cgi_request()
     1884    print_cgi_response(response_headers, output)
    18721885
    18731886def application(environ, start_response):
Note: See TracChangeset for help on using the changeset viewer.