MCPcopy
hub / github.com/tornadoweb/tornado / get

Method get

tornado/test/web_test.py:1185–1203  ·  view source on GitHub ↗
(self, path)

Source from the content-addressed store, hash-verified

1183
1184 class OverrideStaticUrlHandler(RequestHandler):
1185 def get(self, path):
1186 do_include = bool(self.get_argument("include_host"))
1187 self.include_host = not do_include
1188
1189 regular_url = self.static_url(path)
1190 override_url = self.static_url(path, include_host=do_include)
1191 if override_url == regular_url:
1192 return self.write(str(False))
1193
1194 protocol = self.request.protocol + "://"
1195 protocol_length = len(protocol)
1196 check_regular = regular_url.find(protocol, 0, protocol_length)
1197 check_override = override_url.find(protocol, 0, protocol_length)
1198
1199 if do_include:
1200 result = check_override == 0 and check_regular == -1
1201 else:
1202 result = check_override == -1 and check_regular == 0
1203 self.write(str(result))
1204
1205 return [
1206 ("/static_url/(.*)", StaticUrlHandler),

Callers

nothing calls this directly

Calls 4

get_argumentMethod · 0.80
static_urlMethod · 0.80
findMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected