@@ -430,7 +430,7 @@ def add_to_environ(environ: dict, form: dict, **kwargs):
430430 raise IncompleteWebRequest ("Invalid timezone specified" ) from exp
431431
432432
433- def _handle_help (start_response : callable , httphost : str , ** kwargs ):
433+ def _handle_help (httphost : str , ** kwargs ):
434434 """Handle the help request.
435435
436436 Args:
@@ -440,7 +440,6 @@ def _handle_help(start_response: callable, httphost: str, **kwargs):
440440
441441 Returns The HTML response
442442 """
443- start_response ("200 OK" , [("Content-type" , "text/html" )])
444443 # return the module docstring for the func
445444
446445 sdoc = kwargs .get ("help" , "Help not available" )
@@ -482,7 +481,8 @@ def _handle_help(start_response: callable, httphost: str, **kwargs):
482481 "mesonet-dep.agron.iastate.edu" : "dep" ,
483482 "depbackend.local" : "dep" ,
484483 }
485- template = get_site_template (mapper .get (httphost , "iem" ), "full.j2" )
484+ hostkey = httphost .split (":" , 1 )[0 ].lower ()
485+ template = get_site_template (mapper .get (hostkey , "iem" ), "full.j2" )
486486 return template .render (res ).encode ("utf-8" )
487487
488488
@@ -620,7 +620,9 @@ def _iemapp_preflight(
620620 form = clean_form (form )
621621 if "help" in form :
622622 hostname = environ .get ("HTTP_HOST" , "unknown" )
623- return True , _handle_help (start_response , hostname , ** kwargs )
623+ payload = _handle_help (hostname , ** kwargs )
624+ start_response ("200 OK" , [("Content-type" , "text/html" )])
625+ return True , payload
624626 add_to_environ (environ , form , ** kwargs )
625627 if ip_is_throttled (environ , ip_throttle_secs ):
626628 start_response (
0 commit comments