From 46c83bbe8bde87ef8e83e3a49f9ffa3530919301 Mon Sep 17 00:00:00 2001 From: janeczku Date: Fri, 17 Jun 2016 20:01:27 +0200 Subject: [PATCH 1/2] Fix recursive path creation --- cps/web.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cps/web.py b/cps/web.py index 85dce9d6..c9b59200 100755 --- a/cps/web.py +++ b/cps/web.py @@ -10,6 +10,7 @@ mimetypes.add_type('application/xhtml+xml','.xhtml') from flask import Flask, render_template, session, request, Response, redirect, url_for, send_from_directory, make_response, g, flash, abort from cps import db, config, ub, helper import os +import errno from sqlalchemy.sql.expression import func from sqlalchemy.sql.expression import false from sqlalchemy.exc import IntegrityError @@ -504,7 +505,13 @@ def read_book(book_id): (dirName, fileName) = os.path.split(name) newDir = os.path.join(book_dir, dirName) if not os.path.exists(newDir): - os.mkdir(newDir) + try: + os.makedirs(newDir) + except OSError as exception: + if exception.errno == errno.EEXIST: + pass + else: + raise if fileName: fd = open(os.path.join(newDir, fileName), "wb") fd.write(zfile.read(name)) From 374cfd866d7a70f5fb2aadac64e6ab5c9f4e5a68 Mon Sep 17 00:00:00 2001 From: janeczku Date: Fri, 17 Jun 2016 20:01:44 +0200 Subject: [PATCH 2/2] Disable autocomplete in user edit --- cps/templates/user_edit.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cps/templates/user_edit.html b/cps/templates/user_edit.html index 142adfb2..4775af1a 100644 --- a/cps/templates/user_edit.html +++ b/cps/templates/user_edit.html @@ -2,21 +2,21 @@ {% block body %}

{{title}}

-
+ {% if g.user and g.user.role_admin() and new_user %}
- +
{% endif %}
- +
{% if g.user and g.user.role_passwd() or g.user.role_admin()%}
- +
{% endif %}