Skip to content

Commit b3b8457

Browse files
committed
💚 Address codereview
1 parent c42ec19 commit b3b8457

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/pyiem/templates/dep/base.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
<div class="iastate8-google-cse-search-form isu-search search-closed" data-drupal-selector="iastate8-google-cse-search-form" id="block-iastate22-google-cse-block">
129129

130130

131-
<form action="/web-services-documentation" method="post" id="iastate8-google-cse-search-form" accept-charset="UTF-8">
131+
<form action="/web-services-documentation" method="post" id="iastate8-google-cse-search-form-desktop" accept-charset="UTF-8">
132132

133133
<input autocomplete="off" data-drupal-selector="form-rhcxzl3r1i8lhfptzfa4rgchd18bc3nw9ma8bzsb-sq" type="hidden" name="form_build_id" value="form-rHcXZL3R1I8lHFptZFa4rgChD18Bc3nW9mA8BZSb-SQ" />
134134

@@ -148,7 +148,7 @@
148148
<label class="visually-hidden" for="edit-q">Search</label>
149149

150150

151-
<input placeholder="Search" class="isu-form-control_search isu-search__search-field form-text form-control isu-form-control isu-form-control_textfield isu-form-control_search-q" data-drupal-selector="edit-q" type="text" id="edit-q" name="q" value="" size="60" maxlength="128" tabindex="0" />
151+
<input placeholder="Search" class="isu-form-control_search isu-search__search-field form-text form-control isu-form-control isu-form-control_textfield isu-form-control_search-q" data-drupal-selector="edit-q" type="text" id="edit-q-desktop" name="q" value="" size="60" maxlength="128" tabindex="0" />
152152

153153
</div>
154154

src/pyiem/webutil.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)