MCPcopy Create free account
hub / github.com/chubin/cheat.sh / process_post_request

Function process_post_request

lib/post.py:31–53  ·  view source on GitHub ↗

Process POST request `req`.

(req, topic)

Source from the content-addressed store, hash-verified

29
30
31def process_post_request(req, topic):
32 """
33 Process POST request `req`.
34 """
35 for key, val in req.form.items():
36 if key == "":
37 if topic is None:
38 topic_name = "UNNAMED"
39 else:
40 topic_name = topic
41 cheatsheet = val
42 else:
43 if val == "":
44 if topic is None:
45 topic_name = "UNNAMED"
46 else:
47 topic_name = topic
48 cheatsheet = key
49 else:
50 topic_name = key
51 cheatsheet = val
52
53 _save_cheatsheet(topic_name, cheatsheet)

Callers 1

answerFunction · 0.90

Calls 1

_save_cheatsheetFunction · 0.85

Tested by

no test coverage detected