Update testing

Update custom columns unicode enums
pull/774/head
Ozzieisaacs 6 years ago
parent c527d1f49a
commit 32568c9009

@ -9,6 +9,7 @@ import re
import ast import ast
from ub import config from ub import config
import ub import ub
import sys
session = None session = None
cc_exceptions = ['datetime', 'comments', 'float', 'composite', 'series'] cc_exceptions = ['datetime', 'comments', 'float', 'composite', 'series']
@ -301,6 +302,8 @@ class Custom_Columns(Base):
def get_display_dict(self): def get_display_dict(self):
display_dict = ast.literal_eval(self.display) display_dict = ast.literal_eval(self.display)
if sys.version_info < (3, 0):
display_dict['enum_values'] = [x.decode('unicode_escape') for x in display_dict['enum_values']]
return display_dict return display_dict

@ -306,12 +306,12 @@ def update_dir_structure_file(book_id, calibrepath, first_author):
# Rename all files from old names to new names # Rename all files from old names to new names
if authordir != new_authordir or titledir != new_titledir: if authordir != new_authordir or titledir != new_titledir:
try: try:
for format in localbook.data: for file_format in localbook.data:
path_name = os.path.join(calibrepath, new_authordir, os.path.basename(path)) path_name = os.path.join(calibrepath, new_authordir, os.path.basename(path))
new_name = get_valid_filename(localbook.title) + ' - ' + get_valid_filename(new_authordir) new_name = get_valid_filename(localbook.title) + ' - ' + get_valid_filename(new_authordir)
os.renames(os.path.join(path_name, format.name + '.' + format.format.lower()), os.renames(os.path.join(path_name, file_format.name + '.' + file_format.format.lower()),
os.path.join(path_name,new_name + '.' + format.format.lower())) os.path.join(path_name,new_name + '.' + file_format.format.lower()))
format.name = new_name file_format.name = new_name
except OSError as ex: except OSError as ex:
web.app.logger.error("Rename file in path " + path + " to " + new_name + ": " + str(ex)) web.app.logger.error("Rename file in path " + path + " to " + new_name + ": " + str(ex))
web.app.logger.debug(ex, exc_info=True) web.app.logger.debug(ex, exc_info=True)

File diff suppressed because one or more lines are too long

@ -521,8 +521,6 @@ $( '#add-to-shelf' ).attr({
'data-viewport': '.btn-toolbar' }) 'data-viewport': '.btn-toolbar' })
.addClass('addtoshelf-btn-tooltip'); .addClass('addtoshelf-btn-tooltip');
var teetet = $( '#add-to-shelf' ).text()
$( '#have_read_cb' ).attr({ $( '#have_read_cb' ).attr({
'data-toggle': 'tooltip', 'data-toggle': 'tooltip',
'title': 'Mark As Read', 'title': 'Mark As Read',
@ -559,8 +557,6 @@ $( '.btn-group[aria-label="Edit/Delete book"] a' ).attr({
'data-viewport': '.btn-toolbar' }) 'data-viewport': '.btn-toolbar' })
.addClass('edit-btn-tooltip'); .addClass('edit-btn-tooltip');
var teetet = $( '#edit_book' ).text()
$( '#sendbtn' ).attr({ $( '#sendbtn' ).attr({
'data-toggle': 'tooltip', 'data-toggle': 'tooltip',
'title': 'Send to Kindle', 'title': 'Send to Kindle',

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
!function(a){a.fn.datepicker.dates.ja={days:["日曜","月曜","火曜","水曜","木曜","金曜","土曜"],daysShort:["日","月","火","水","木","金","土"],daysMin:["日","月","火","水","木","金","土"],months:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],monthsShort:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],today:"今日",format:"yyyy/mm/dd",titleFormat:"yyyy年mm月",clear:"クリア"}}(jQuery);

@ -675,7 +675,7 @@ function Unpack29(bstream) {
continue; continue;
} }
} }
rarUpdateProgress() rarUpdateProgress();
} }
function rarReadEndOfBlock(bstream) { function rarReadEndOfBlock(bstream) {
@ -746,7 +746,7 @@ function rarCopyString(length, distance) {
} }
} }
var rOldBuffers = [] var rOldBuffers = [];
// v must be a valid RarVolume // v must be a valid RarVolume
function unpack(v) { function unpack(v) {
@ -818,7 +818,7 @@ RarLocalFile.prototype.unrar = function() {
this.fileData = unpack(this); this.fileData = unpack(this);
} }
} }
} };
var unrar = function(arrayBuffer) { var unrar = function(arrayBuffer) {
currentFilename = ""; currentFilename = "";
@ -835,16 +835,16 @@ var unrar = function(arrayBuffer) {
if (header.crc === 0x6152 && if (header.crc === 0x6152 &&
header.headType === 0x72 && header.headType === 0x72 &&
header.flags.value === 0x1A21 && header.flags.value === 0x1A21 &&
header.headSize === 7) header.headSize === 7) {
{
info("Found RAR signature"); info("Found RAR signature");
var mhead = new RarVolumeHeader(bstream); var mhead = new RarVolumeHeader(bstream);
if (mhead.headType != MAIN_HEAD) { if (mhead.headType != MAIN_HEAD) {
info("Error! RAR did not include a MAIN_HEAD header"); info("Error! RAR did not include a MAIN_HEAD header");
} else { } else {
var localFiles = [], var localFiles = [];
localFile = null; var localFile = null;
do { do {
try { try {
localFile = new RarLocalFile(bstream); localFile = new RarLocalFile(bstream);
@ -870,7 +870,7 @@ var unrar = function(arrayBuffer) {
return aname > bname ? 1 : -1; return aname > bname ? 1 : -1;
}); });
info(localFiles.map(function(a) {return a.filename}).join(', ')); info(localFiles.map(function(a) {return a.filename;}).join(", "));
for (var i = 0; i < localFiles.length; ++i) { for (var i = 0; i < localFiles.length; ++i) {
var localfile = localFiles[i]; var localfile = localFiles[i];

@ -572,14 +572,13 @@ function inflate(compressedData, numDecompressedBytes) {
} }
} }
else if (symbol == 17) { else if (symbol == 17) {
var repeat = bstream.readBits(3) + 3; var repeat1 = bstream.readBits(3) + 3;
while (repeat--) { while (repeat1--) {
literalCodeLengths.push(0); literalCodeLengths.push(0);
} }
} } else if (symbol == 18) {
else if (symbol == 18) { var repeat2 = bstream.readBits(7) + 11;
var repeat = bstream.readBits(7) + 11; while (repeat2--) {
while (repeat--) {
literalCodeLengths.push(0); literalCodeLengths.push(0);
} }
} }

@ -176,7 +176,7 @@
</div> </div>
<div class="modal-body text-center"> <div class="modal-body text-center">
<div id="spinner2" class="spinner2" style="display:none;"> <div id="spinner2" class="spinner2" style="display:none;">
<img id="img-spinner" src="{{ url_for('static', filename='css/images/loading-icon.gif') }}"/> <img id="img-spinner2" src="{{ url_for('static', filename='css/images/loading-icon.gif') }}"/>
</div> </div>
<p></p> <p></p>
<div id="Updatecontent"></div> <div id="Updatecontent"></div>

@ -41,16 +41,11 @@ See https://github.com/adobe-type-tools/cmap-resources
<!--<link rel="resource" type="application/l10n" href="locale/locale.properties">--> <!--<link rel="resource" type="application/l10n" href="locale/locale.properties">-->
<link rel="resource" type="application/l10n" href="{{ url_for('static', filename='locale/locale.properties') }}"> <link rel="resource" type="application/l10n" href="{{ url_for('static', filename='locale/locale.properties') }}">
<script src="{{ url_for('static', filename='js/libs/l10n.js') }}"></script> <script src="{{ url_for('static', filename='js/libs/l10n.js') }}"></script>
<!--<script src="l10n.js"></script>-->
<!--script src="{{ url_for('static', filename='js/libs/debugger.js') }}"></script-->
<!--<script src="debugger.js"></script>-->
<script src="{{ url_for('static', filename='js/libs/pdf.js') }}"></script> <script src="{{ url_for('static', filename='js/libs/pdf.js') }}"></script>
<!--<script src="pdf.js"></script>-->
<script type="text/javascript"> <script type="text/javascript">
var DEFAULT_URL = "{{ url_for('serve_book', book_id=pdffile, book_format='pdf') }}"; var DEFAULT_URL = "{{ url_for('serve_book', book_id=pdffile, book_format='pdf') }}";
var PDFWORKER_LOCATION="{{ url_for('static', filename='js/libs/pdf.worker.js') }}"; var PDFWORKER_LOCATION="{{ url_for('static', filename='js/libs/pdf.worker.js') }}";
// var IMAGE_LOCATION="{{ url_for('static', filename='css/../images') }}";
var IMAGE_LOCATION="{{ url_for('static', filename='/images/') }}"; var IMAGE_LOCATION="{{ url_for('static', filename='/images/') }}";
var PDFWORKER_LOCATION_JS="{{ url_for('static', filename='js/libs/pdf.worker') }}"; var PDFWORKER_LOCATION_JS="{{ url_for('static', filename='js/libs/pdf.worker') }}";
</script> </script>
@ -420,8 +415,7 @@ See https://github.com/adobe-type-tools/cmap-resources
} }
</style> </style>
<div class="mozPrintCallback-dialog-box"> <div class="mozPrintCallback-dialog-box">
<!-- TODO: Localise the following strings --> {{_('Preparing document for printing...')}}
Preparing document for printing...
<div class="progress-row"> <div class="progress-row">
<progress value="0" max="100"></progress> <progress value="0" max="100"></progress>
<span class="relative-progress">0%</span> <span class="relative-progress">0%</span>

@ -141,10 +141,7 @@
{% endif %} {% endif %}
{% if c.datatype == 'rating' %} {% if c.datatype == 'rating' %}
<input type="number" min="1" max="5" step="1" class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}" <input type="number" min="1" max="5" step="1" class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}">
{% if book['custom_column_' ~ c.id]|length > 0 %}
value="{{ '%d' % (book['custom_column_' ~ c.id][0].value / 2) }}"
{% endif %}>
{% endif %} {% endif %}
</div> </div>
{% endfor %} {% endfor %}

@ -1192,8 +1192,8 @@ def get_update_status():
r = requests.get(repository_url + '/git/commits/' + commit['object']['sha']) r = requests.get(repository_url + '/git/commits/' + commit['object']['sha'])
r.raise_for_status() r.raise_for_status()
update_data = r.json() update_data = r.json()
except requests.exceptions.HTTPError as ex: except requests.exceptions.HTTPError as e:
status['error'] = _(u'HTTP Error') + ' ' + str(ex) status['error'] = _(u'HTTP Error') + ' ' + str(e)
except requests.exceptions.ConnectionError: except requests.exceptions.ConnectionError:
status['error'] = _(u'Connection error') status['error'] = _(u'Connection error')
except requests.exceptions.Timeout: except requests.exceptions.Timeout:

@ -108,7 +108,7 @@ class emailbase():
self.transferSize = len(strg) self.transferSize = len(strg)
lock.release() lock.release()
for i in range(0, self.transferSize, chunksize): for i in range(0, self.transferSize, chunksize):
if type(strg) == bytes: if isinstance(strg, bytes):
self.sock.send((strg[i:i+chunksize])) self.sock.send((strg[i:i+chunksize]))
else: else:
self.sock.send((strg[i:i + chunksize]).encode('utf-8')) self.sock.send((strg[i:i + chunksize]).encode('utf-8'))
@ -455,6 +455,8 @@ class WorkerThread(threading.Thread):
except (smtplib.SMTPException) as e: except (smtplib.SMTPException) as e:
if hasattr(e, "smtp_error"): if hasattr(e, "smtp_error"):
text = e.smtp_error.replace("\n",'. ') text = e.smtp_error.replace("\n",'. ')
elif hasattr(e, "message"):
text = e.message
else: else:
text = '' text = ''
self._handleError(u'Error sending email: ' + text) self._handleError(u'Error sending email: ' + text)
@ -501,10 +503,13 @@ class StderrLogger(object):
self.logger = web.app.logger self.logger = web.app.logger
def write(self, message): def write(self, message):
try:
if message == '\n': if message == '\n':
self.logger.debug(self.buffer) self.logger.debug(self.buffer)
print(self.buffer) print(self.buffer)
self.buffer = '' self.buffer = ''
else: else:
self.buffer += message self.buffer += message
except:
pass

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save