Changeset 13936 in genesis for tools


Ignore:
Timestamp:
Jul 6, 2017, 9:00:04 AM (7 years ago)
Author:
rick
Message:

Add text/plain to list of accepted plain targets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gformat.py

    r13935 r13936  
    17481748def is_text_request(environ=os.environ):
    17491749  """ Find out whether we are calling from the CLI or any text based CLI utility """
    1750   try:
    1751     return environ['HTTP_USER_AGENT'].split()[0] in ['curl', 'fetch', 'wget']
    1752   except KeyError:
     1750  if 'CONTENT_TYPE' in os.environ and os.environ['CONTENT_TYPE'] == 'text/plain':
    17531751    return True
     1752
     1753  if 'HTTP_USER_AGENT' in environ:
     1754    return any([os.environ['HTTP_USER_AGENT'].lower().startswith(x) for x in ['curl', 'fetch', 'wget']])
     1755  else:
     1756    return False
     1757
    17541758
    17551759def switchFormat(setting):
Note: See TracChangeset for help on using the changeset viewer.