fixed bugs
This commit is contained in:
8
shop.py
8
shop.py
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user