dont fail with inconsistent changelogs

This commit is contained in:
j 2014-05-19 03:36:37 +02:00
parent 224864bace
commit b6866cb2be
6 changed files with 9 additions and 7 deletions

View file

@ -379,7 +379,8 @@ class Item(db.Model):
remove_empty_folders(os.path.dirname(path)) remove_empty_folders(os.path.dirname(path))
db.session.delete(f) db.session.delete(f)
user = state.user() user = state.user()
self.users.remove(user) if user in self.users:
self.users.remove(user)
db.session.commit() db.session.commit()
if not self.users: if not self.users:
db.session.delete(self) db.session.delete(self)

View file

@ -69,7 +69,7 @@ def get_ids(key, value):
if (id, v) not in ids: if (id, v) not in ids:
ids.append((id, v)) ids.append((id, v))
elif key in ('isbn10', 'isbn13', 'oclc', 'lccn'): elif key in ('isbn10', 'isbn13', 'oclc', 'lccn'):
logger.debug('openlibraryid.get_ids %s %s', key, value) logger.debug('get_ids %s %s', key, value)
r = api.things({'type': '/type/edition', key.replace('isbn', 'isbn_'): value}) r = api.things({'type': '/type/edition', key.replace('isbn', 'isbn_'): value})
for b in r.get('result', []): for b in r.get('result', []):
if b.startswith('/books'): if b.startswith('/books'):

View file

@ -170,7 +170,7 @@ class Node(object):
if u.peered or u.queued: if u.peered or u.queued:
try: try:
self.online = False self.online = False
logger.debug('type to connect to %s', self.user_id) logger.debug('type to connect to %s at [%s]:%s', self.user_id, self.host, self.port)
if self.can_connect(): if self.can_connect():
self.online = True self.online = True
if u.queued: if u.queued:

View file

@ -60,7 +60,7 @@ class Parser(object):
} }
... ...
''' '''
logger.debug('parse_condition %s', condition) #logger.debug('parse_condition %s', condition)
if not 'value' in condition: if not 'value' in condition:
return None return None
k = condition.get('key', '*') k = condition.get('key', '*')

View file

@ -204,7 +204,8 @@ class List(db.Model):
from item.models import Item from item.models import Item
for item_id in items: for item_id in items:
i = Item.get(item_id) i = Item.get(item_id)
self.items.remove(i) if i in self.items:
self.items.remove(i)
i.update() i.update()
db.session.add(self) db.session.add(self)
db.session.commit() db.session.commit()

View file

@ -26,11 +26,11 @@ oml.ui.deleteItemsDialog = function() {
ids: items ids: items
}, function() { }, function() {
oml.UI.set({listSelection: []}); oml.UI.set({listSelection: []});
Ox.Request.clearCache('find'); Ox.Request.clearCache(); // to much?
oml.$ui.list.updateElement(); oml.$ui.list.updateElement();
}); });
}); });
return that; return that;
}; };