Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
skip on migrating theme users who are not in temp database but are in…
Browse files Browse the repository at this point in the history
… prod
  • Loading branch information
cvan committed Apr 9, 2013
1 parent a53ff0a commit e2442e8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions apps/addons/management/commands/import_personas_users.py
Expand Up @@ -159,12 +159,18 @@ def handle_user(self, user):
collection_id = self.cursor_z.fetchone()[0]
except TypeError:
uuid_ = unicode(uuid.uuid4())
self.cursor_z.execute("""
INSERT INTO collections (created, modified, uuid, slug,
defaultlocale, collection_type, author_id)
VALUES (NOW(), NOW(), %s, 'favorites', 'en-US', 4, %s)
""", (uuid_, data['user_id']))
collection_id = self.cursor_z.lastrowid
try:
self.cursor_z.execute("""
INSERT INTO collections (created, modified, uuid, slug,
defaultlocale, collection_type, author_id)
VALUES (NOW(), NOW(), %s, 'favorites', 'en-US', 4, %s)
""", (uuid_, data['user_id']))
except IntegrityError:
self.log(' Failed saving collection for unknown user - '
'hopefully prod is okay (%s)' % user['email'])
continue
else:
collection_id = self.cursor_z.lastrowid

rows = []
for fav in self.get_favourites(user['username']):
Expand Down

0 comments on commit e2442e8

Please sign in to comment.