Update testing

Update custom columns unicode enums
This commit is contained in:
Ozzieisaacs 2019-01-14 20:27:53 +01:00
parent c527d1f49a
commit 32568c9009
16 changed files with 3970 additions and 189 deletions

View File

@ -9,6 +9,7 @@ import re
import ast
from ub import config
import ub
import sys
session = None
cc_exceptions = ['datetime', 'comments', 'float', 'composite', 'series']
@ -301,6 +302,8 @@ class Custom_Columns(Base):
def get_display_dict(self):
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

View File

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

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

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

View File

@ -176,7 +176,7 @@
</div>
<div class="modal-body text-center">
<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>
<p></p>
<div id="Updatecontent"></div>

View File

@ -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="{{ url_for('static', filename='locale/locale.properties') }}">
<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="pdf.js"></script>-->
<script type="text/javascript">
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 IMAGE_LOCATION="{{ url_for('static', filename='css/../images') }}";
var IMAGE_LOCATION="{{ url_for('static', filename='/images/') }}";
var PDFWORKER_LOCATION_JS="{{ url_for('static', filename='js/libs/pdf.worker') }}";
</script>
@ -420,8 +415,7 @@ See https://github.com/adobe-type-tools/cmap-resources
}
</style>
<div class="mozPrintCallback-dialog-box">
<!-- TODO: Localise the following strings -->
Preparing document for printing...
{{_('Preparing document for printing...')}}
<div class="progress-row">
<progress value="0" max="100"></progress>
<span class="relative-progress">0%</span>

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff