Move template to global to get rid of indentation.
This commit is contained in:
parent
4d90536329
commit
2ec1f7c7ff
1 changed files with 11 additions and 10 deletions
|
@ -10,19 +10,20 @@ log = vlogging.getLogger(__name__, 'heresmyclipboard')
|
||||||
|
|
||||||
site = flask.Flask(__name__)
|
site = flask.Flask(__name__)
|
||||||
|
|
||||||
|
TEMPLATE = '''
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<pre>
|
||||||
|
{{clip}}
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
'''
|
||||||
|
|
||||||
@site.route('/')
|
@site.route('/')
|
||||||
def root():
|
def root():
|
||||||
clip = pyperclip.paste()
|
clip = pyperclip.paste()
|
||||||
template = '''
|
return flask.render_template_string(TEMPLATE, clip=clip)
|
||||||
<html>
|
|
||||||
<body>
|
|
||||||
<pre>
|
|
||||||
{{clip}}
|
|
||||||
</pre>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
'''
|
|
||||||
return flask.render_template_string(template, clip=clip)
|
|
||||||
|
|
||||||
def heresmyclipboard_argparse(args):
|
def heresmyclipboard_argparse(args):
|
||||||
log.info(f'Starting server on port {args.port}, pid={os.getpid()}')
|
log.info(f'Starting server on port {args.port}, pid={os.getpid()}')
|
||||||
|
|
Loading…
Reference in a new issue