only save if update_external fails

This commit is contained in:
j 2016-06-20 18:28:05 +02:00
parent d83647c4a5
commit aaacc48259

View file

@ -98,8 +98,8 @@ def get_item(info, user=None):
item.external_data = item_data item.external_data = item_data
item.user = user item.user = user
item.oxdbId = item.public_id item.oxdbId = item.public_id
item.save(sync=True) if not item.update_external():
item.update_external() item.save(sync=True)
else: else:
public_id = get_id(info) public_id = get_id(info)
if public_id: if public_id:
@ -299,11 +299,9 @@ class Item(models.Model):
response = external_data('getData', {'id': self.public_id}) response = external_data('getData', {'id': self.public_id})
if response['status']['code'] == 200: if response['status']['code'] == 200:
self.external_data = response['data'] self.external_data = response['data']
p = self.save() self.save(sync=True)
if p: return True
p.wait() return False
else:
self.make_poster(True)
def add_default_data(self): def add_default_data(self):
for k in settings.CONFIG['itemKeys']: for k in settings.CONFIG['itemKeys']: