fixed bugs

This commit is contained in:
q
2016-07-05 12:51:17 +03:00
parent 9813cf6263
commit ba05dd9c74
3 changed files with 21 additions and 6 deletions

View File

@@ -14,6 +14,7 @@ SECRET_KEY = 'development key'
USERNAME = 'admin'
PASSWORD = 'default'
URLFINDER = re.compile("((news|telnet|nttp|file|http|ftp|https)://[^ ]+)")
URLPARSER = re.compile(r'(\[)([^\]]+)(\])\(([^\)]+)\)')
# create our little application :)
app = Flask(__name__)
@@ -87,6 +88,8 @@ def scan_for_new_documents(id):
g.db.commit()
def urlify(s):
if URLPARSER.search(s):
return URLPARSER.sub(r'[<a href="\4" target="_blank">\2</a>]',s)
return URLFINDER.sub(r'<a href="\1" target="_blank">\1</a>', s)
@app.before_request
@@ -129,7 +132,10 @@ def show_shop(shopid):
continue
icon=" "
extra_class="noitem"
if "[ ]" in row or "[x]" in row:
if "[ ]" in row:
icon=u" "
extra_class=""
if "[x]" in row:
icon=u"\u2714"
extra_class=""
row=urlify(row).encode('ascii', 'xmlcharrefreplace')