Merge branch 'disable-autocomplete'

This commit is contained in:
janeczku 2016-06-17 20:01:53 +02:00
commit bd686ad6ed
2 changed files with 12 additions and 5 deletions

View File

@ -2,21 +2,21 @@
{% block body %}
<div class="discover">
<h1>{{title}}</h1>
<form role="form" method="POST">
<form role="form" method="POST" autocomplete="off">
{% if g.user and g.user.role_admin() and new_user %}
<div class="form-group required">
<label for="nickname">Username</label>
<input type="text" class="form-control" name="nickname" id="nickname" value="{{ content.nickname if content.nickname != None }}">
<input type="text" class="form-control" name="nickname" id="nickname" value="{{ content.nickname if content.nickname != None }}" autocomplete="off">
</div>
{% endif %}
<div class="form-group">
<label for="email">Email address</label>
<input type="email" class="form-control" name="email" id="email" value="{{ content.email if content.email != None }}" required>
<input type="email" class="form-control" name="email" id="email" value="{{ content.email if content.email != None }}" autocomplete="off" required>
</div>
{% if g.user and g.user.role_passwd() or g.user.role_admin()%}
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" name="password" id="password" value="">
<input type="password" class="form-control" name="password" id="password" value="" autocomplete="off">
</div>
{% endif %}
<div class="form-group">

View File

@ -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))