create file if missing
This commit is contained in:
2
shop.py
2
shop.py
@@ -119,6 +119,8 @@ def show_shop(shopid):
|
|||||||
return redirect(url_for('list_shops'))
|
return redirect(url_for('list_shops'))
|
||||||
data_dir=os.path.join(DATADIR, get_username(row[2]))
|
data_dir=os.path.join(DATADIR, get_username(row[2]))
|
||||||
data_file=os.path.join(data_dir, row[1]+".md")
|
data_file=os.path.join(data_dir, row[1]+".md")
|
||||||
|
if not os.path.exists(data_file):
|
||||||
|
open(data_file, 'wt').close()
|
||||||
entries=[]
|
entries=[]
|
||||||
content=open(data_file, 'rt').read().decode('utf-8')
|
content=open(data_file, 'rt').read().decode('utf-8')
|
||||||
for i,row in enumerate(open( data_file, 'rt').read().decode('utf-8').split("\n")):
|
for i,row in enumerate(open( data_file, 'rt').read().decode('utf-8').split("\n")):
|
||||||
|
|||||||
Reference in New Issue
Block a user