migration-merged-fixes
This commit is contained in:
commit
c116a99025
3
auth/__init__.py
Normal file
3
auth/__init__.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from auth.email import load_email_templates
|
||||||
|
|
||||||
|
load_email_templates()
|
|
@ -90,7 +90,7 @@ def topics(export_topics, topics_by_slug, topics_by_oid, cats_data, tags_data):
|
||||||
topic = migrateTag(tag)
|
topic = migrateTag(tag)
|
||||||
topics_by_title[topic['title']] = topic
|
topics_by_title[topic['title']] = topic
|
||||||
topics_by_oid[topic['tag_id']] = topic
|
topics_by_oid[topic['tag_id']] = topic
|
||||||
if not topics_by_slug.get(topic['slug']): topics_by_slug[topic['slug']] = topic
|
# if not topics_by_slug.get(topic['slug']): topics_by_slug[topic['slug']] = topic
|
||||||
counter += 1
|
counter += 1
|
||||||
for cat in cats_data:
|
for cat in cats_data:
|
||||||
old_id = cat["createdBy"]
|
old_id = cat["createdBy"]
|
||||||
|
@ -98,10 +98,11 @@ def topics(export_topics, topics_by_slug, topics_by_oid, cats_data, tags_data):
|
||||||
try: topic = migrateCategory(cat)
|
try: topic = migrateCategory(cat)
|
||||||
except Exception as e: raise e
|
except Exception as e: raise e
|
||||||
topics_by_oid[topic['cat_id']] = topic
|
topics_by_oid[topic['cat_id']] = topic
|
||||||
topics_by_slug[topic['slug']] = topic
|
|
||||||
topics_by_title[topic['title']] = topic
|
topics_by_title[topic['title']] = topic
|
||||||
counter += 1
|
counter += 1
|
||||||
export_topics = dict(topics_by_title.items())
|
for t in topics_by_title.values():
|
||||||
|
topics_by_slug[t['slug']] = t
|
||||||
|
export_topics = dict(topics_by_slug.items())
|
||||||
|
|
||||||
def shouts(content_data, shouts_by_slug, shouts_by_oid):
|
def shouts(content_data, shouts_by_slug, shouts_by_oid):
|
||||||
''' migrating content items one by one '''
|
''' migrating content items one by one '''
|
||||||
|
|
|
@ -110,7 +110,7 @@ def migrate(entry, users_by_oid, topics_by_oid):
|
||||||
if entry.get('type') == 'Literature':
|
if entry.get('type') == 'Literature':
|
||||||
media = entry.get('media', '')
|
media = entry.get('media', '')
|
||||||
# print(media[0]['literatureBody'])
|
# print(media[0]['literatureBody'])
|
||||||
if type(media) == list:
|
if type(media) == list and media:
|
||||||
body_orig = media[0].get('literatureBody', '')
|
body_orig = media[0].get('literatureBody', '')
|
||||||
if body_orig == '':
|
if body_orig == '':
|
||||||
print('EMPTY BODY!')
|
print('EMPTY BODY!')
|
||||||
|
|
|
@ -34,7 +34,8 @@ def migrate(entry):
|
||||||
res['old_id'] = entry['_id']
|
res['old_id'] = entry['_id']
|
||||||
res['password'] = entry['services']['password'].get('bcrypt', '')
|
res['password'] = entry['services']['password'].get('bcrypt', '')
|
||||||
del entry['services']
|
del entry['services']
|
||||||
if entry.get('subscribedTo', '') != '': del entry['subscribedTo']
|
if 'subscribedTo' in entry: #TODO: use subscribedTo
|
||||||
|
del entry['subscribedTo']
|
||||||
res['username'] = entry['emails'][0]['address']
|
res['username'] = entry['emails'][0]['address']
|
||||||
res['email'] = res['username']
|
res['email'] = res['username']
|
||||||
res['wasOnlineAt'] = parse(entry.get('loggedInAt', entry['createdAt']))
|
res['wasOnlineAt'] = parse(entry.get('loggedInAt', entry['createdAt']))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user