def remove_render_over_limit(url):
db = get_db()
cur = db.cursor()
cur.execute('UPDATE plans SET render_deleted=TRUE WHERE url='+app.sqlesc+' RETURNING image_url, base_path',(url,))
image_url, base_path = cur.fetchone()
if image_url != None and os.path.split(os.path.split(image_url)[0])[1] == url:
# second condition ensures you're in a folder named after the URL which prevents accidentally deleting placeholders
try:
os.remove(legacy_location(image_url))
except:
pass
try:
os.rmdir(legacy_location(base_path))
except:
pass
db.commit()
评论列表
文章目录