URI:
       tpep8 - blck - ephemeral pastebin/url shortener
  HTML git clone https://git.parazyd.org/blck
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 7735f76b4850a6ab87ab0ac16ef4a3d25b8c01ef
   DIR parent af48387155ff2508b48b13717f1ecdc8eddba379
  HTML Author: parazyd <parazyd@dyne.org>
       Date:   Wed,  3 May 2017 03:02:39 +0200
       
       pep8
       
       Diffstat:
         M blck.py                             |       9 ++++++---
       
       1 file changed, 6 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/blck.py b/blck.py
       t@@ -1,4 +1,4 @@
       -#!/usr/bin/env python2
       +#!/usr/bin/env python
        # copyleft (c) 2017 - parazyd
        # see LICENSE file for details
        
       t@@ -10,6 +10,7 @@ import string
        
        app = flask.Flask(__name__)
        
       +
        @app.route("/", methods=['GET', 'POST'])
        def main():
            try:
       t@@ -18,6 +19,7 @@ def main():
            except:
                return flask.render_template("index.html")
        
       +
        @app.route("/<urlshort>")
        def u(urlshort):
            try:
       t@@ -37,7 +39,7 @@ def s(url):
            ## taken from django
            regex = re.compile(
                r'^(?:http|ftp)s?://' # http:// or https://
       -        r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' #domain...
       +        r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|'
                r'localhost|' #localhost...
                r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip
                r'(?::\d+)?' # optional port
       t@@ -54,7 +56,8 @@ def s(url):
                return "could not save url\n"
        
            if flask.request.headers.get('X-Forwarded-Proto') == 'https':
       -        return flask.request.url_root.replace('http://', 'https://') + urlshort + '\n'
       +        return flask.request.url_root.replace('http://', 'https://') \
       +            + urlshort + '\n'
        
            return flask.request.url_root + urlshort + '\n'