introduce debugging.. but dont actually use it anywhere

This commit is contained in:
2018-01-25 15:16:38 +02:00
parent 4aa8ff238b
commit fd18d5f162

View File

@@ -17,6 +17,7 @@ app.config['UPLOAD_FOLDER'] = 'data/'
app.config['SHARES_FILE'] = 'data/shares.json'
app.config['DATE_FORMAT'] = "%Y-%m-%d %H:%M"
app.config['UID'] = 1000
app.config['DEBUG'] = False
app.secret_key = 'Cz2dw5NiRt3PSMFBSLTAJJi7U2CdW7iPQqEeOaU6'
app.wsgi_app = ReverseProxied(app.wsgi_app)
@@ -27,7 +28,6 @@ def before_request():
@app.route("/")
def index():
printerr(g.shares)
public_shares = []
for share in g.shares:
public = get_or_none(share,'public')
@@ -70,6 +70,7 @@ def upload(name = None, password = None):
)
)
if get_or_none(share, 'overwrite') == False:
if os.path.exists(filename):
return "Overwrite forbidden", 403
file.save(filename)
os.chown(filename, app.config['UID'], -1)
@@ -198,7 +199,8 @@ def is_expired(share):
return True
return False
def printerr(s):
def print_debug(s):
if app.config['DEBUG']:
sys.stderr.write(str(s)+"\n")
sys.stderr.flush()