less bloat
This commit is contained in:
parent
e69339799e
commit
ce3f3339e9
|
@ -39,16 +39,11 @@ def migrate(entry, topics_by_oid):
|
||||||
else:
|
else:
|
||||||
if len(topic.title) > len(topic_dict['title']) or \
|
if len(topic.title) > len(topic_dict['title']) or \
|
||||||
len(topic.body) < len(topic_dict['body']):
|
len(topic.body) < len(topic_dict['body']):
|
||||||
print('updating topic')
|
|
||||||
topic.update({
|
topic.update({
|
||||||
'slug': slug,
|
'slug': slug,
|
||||||
'title': topic_dict['title'] if len(topic.title) > len(topic_dict['title']) else topic.title,
|
'title': topic_dict['title'] if len(topic.title) > len(topic_dict['title']) else topic.title,
|
||||||
'body': topic_dict['body'] if len(topic.body) < len(topic_dict['body']) else topic.body,
|
'body': topic_dict['body'] if len(topic.body) < len(topic_dict['body']) else topic.body
|
||||||
#'views': topic.views + topic_dict['views']
|
|
||||||
#'authors': topic.views + topic_dict['views']
|
|
||||||
#'followers': topic.views + topic_dict['views']
|
|
||||||
})
|
})
|
||||||
print(slug + ': ' + topic.title)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('not found old topic: ' + slug)
|
print('not found old topic: ' + slug)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -39,11 +39,6 @@ def migrate(entry, topics_by_oid):
|
||||||
if not topic:
|
if not topic:
|
||||||
del topic_dict['oid']
|
del topic_dict['oid']
|
||||||
topic = Topic.create(**topic_dict)
|
topic = Topic.create(**topic_dict)
|
||||||
else:
|
|
||||||
print(slug + ': ' + topic.title)
|
|
||||||
else:
|
|
||||||
print('not found topic: ' + slug)
|
|
||||||
raise Exception
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
raise e
|
raise e
|
||||||
|
|
Loading…
Reference in New Issue
Block a user