Move template to global to get rid of indentation.

This commit is contained in:
voussoir 2021-05-14 17:40:07 -07:00
parent 4d90536329
commit 2ec1f7c7ff
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -10,19 +10,20 @@ log = vlogging.getLogger(__name__, 'heresmyclipboard')
site = flask.Flask(__name__)
TEMPLATE = '''
<html>
<body>
<pre>
{{clip}}
</pre>
</body>
</html>
'''
@site.route('/')
def root():
clip = pyperclip.paste()
template = '''
<html>
<body>
<pre>
{{clip}}
</pre>
</body>
</html>
'''
return flask.render_template_string(template, clip=clip)
return flask.render_template_string(TEMPLATE, clip=clip)
def heresmyclipboard_argparse(args):
log.info(f'Starting server on port {args.port}, pid={os.getpid()}')