Changeset 10681 in genesis


Ignore:
Timestamp:
May 6, 2012, 1:37:51 PM (13 years ago)
Author:
rick
Message:

Content-Length header should help us making fetch more happy with regards to file retrival.

Related-To: beheer#209

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r10665 r10681  
    942942  uri = base_uri.strip('/').split('/')
    943943
    944   output = ""
     944  output = "Template Holder"
     945  content_type='text/plain'
    945946  if base_uri.endswith('/create/network.kml'):
    946       output += "Content-type:application/vnd.google-earth.kml+xml\r\n\r\n"
    947       output += make_network_kml.make_graph()
     947      content_type='application/vnd.google-earth.kml+xml'
     948      output = make_network_kml.make_graph()
    948949  elif not uri[0]:
    949950    if is_text_request():
    950       output += "Content-type:text/plain\r\n\r\n"
    951       output += '\n'.join(get_hostlist())
     951      content_type = 'text/plain'
     952      output = '\n'.join(get_hostlist())
    952953    else:
    953       output += "Content-type:text/html\r\n\r\n"
    954       output += generate_title(get_hostlist())
     954      content_type = 'text/html'
     955      output = generate_title(get_hostlist())
    955956  elif len(uri) == 1:
    956957    if is_text_request():
    957       output += "Content-type:text/plain\r\n\r\n"
    958       output += generate_node(uri[0])
     958      content_type = 'text/plain'
     959      output = generate_node(uri[0])
    959960    else:
    960       output += "Content-type:text/html\r\n\r\n"
    961       output += generate_node_overview(uri[0])
     961      content_type = 'text/html'
     962      output = generate_node_overview(uri[0])
    962963  elif len(uri) == 2:
    963     output += "Content-type:text/plain\r\n\r\n"
    964     output += generate_config(uri[0], uri[1])
     964    content_type = 'text/plain'
     965    output = generate_config(uri[0], uri[1])
    965966  else:
    966967    assert False, "Invalid option"
     968
     969  print "Content-Type: %s" % content_type
     970  print "Content-Length: %s" % len(output)
     971  print ""
    967972  print output
    968973
Note: See TracChangeset for help on using the changeset viewer.