Skip to content
This repository was archived by the owner on Sep 23, 2022. It is now read-only.

Commit 987a8de

Browse files
committed
Fix breaking errors
1 parent 7449216 commit 987a8de

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

ygo_cards/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def save(self, *args, **kwargs):
273273

274274
def set_prices(self, data):
275275

276-
for key, value in data.iteritems():
276+
for key, value in data['data']['prices'].iteritems():
277277
try:
278278
setattr(self, 'price_' + key, float(value))
279279
except:

ygo_cards/tasks/cards.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,18 @@ def get_wiki_data(identifier):
3838
.parents('th').next().text())
3939
}
4040

41-
description_element = (card.find('td table table').eq(0)
42-
.find('tr').eq(2).find('td').eq(0))
41+
try:
42+
description_element = (card.find('td table table').eq(0)
43+
.find('tr').eq(2).find('td').eq(0))
4344

44-
description_element.html(re.sub(r'<br ?/?>', BREAK_TOKEN,
45-
description_element.html()))
45+
description_element.html(re.sub(r'<br ?/?>', BREAK_TOKEN,
46+
description_element.html()))
4647

47-
data['description'] = process_string(description_element.text())
48+
data['description'] = process_string(description_element.text())
4849

49-
data['description'] = data['description'].replace(BREAK_TOKEN, '<br />')
50+
data['description'] = data['description'].replace(BREAK_TOKEN, '<br />')
51+
except:
52+
data['description'] = ''
5053

5154
try:
5255
data['number'] = process_string(card.find('th a[title="Card Number"]')

0 commit comments

Comments
 (0)