From 65f2791b29c8c9fe5eb2681c0d8ab97e34e87301 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Mon, 27 Jun 2011 19:18:15 -0400 Subject: fixed a small issue in SE import --- .../stackexchange/management/commands/load_stackexchange.py | 9 ++++++++- askbot/importers/stackexchange/models.py | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/askbot/importers/stackexchange/management/commands/load_stackexchange.py b/askbot/importers/stackexchange/management/commands/load_stackexchange.py index f4c71f9a..d0067c7c 100644 --- a/askbot/importers/stackexchange/management/commands/load_stackexchange.py +++ b/askbot/importers/stackexchange/management/commands/load_stackexchange.py @@ -39,7 +39,7 @@ xml_read_order = ( 'UserHistoryTypes','UserHistory', 'Users2Badges','VoteTypes','Users2Votes','MessageTypes', 'Posts','Posts2Votes','PostHistory','PostComments', - 'ModeratorMessages','Messages','Comments2Votes', + 'ModeratorMessages','Messages','Comments2Votes', 'Passwords', ) HEAP = hpy() @@ -366,6 +366,7 @@ class Command(BaseCommand): transaction.commit() self.transfer_meta_pages() transaction.commit() + print 'done.' def open_dump(self, path): """open the zipfile, raise error if it @@ -869,6 +870,12 @@ class Command(BaseCommand): elif u_type not in ('Unregistered', 'Registered'): raise Exception('unknown user type %s' % u_type) + if se_u.password_id is not None: + pw = se.Password.objects.get(id = se_u.password_id) + u.password = 'sha1$%s$%s' % (pw.salt, pw.password) + else: + u.set_unusable_password() + #if user is not registered, no association record created #we do not allow posting by users who are not authenticated #probably they'll just have to "recover" their account by email diff --git a/askbot/importers/stackexchange/models.py b/askbot/importers/stackexchange/models.py index a30a9859..227a9adf 100644 --- a/askbot/importers/stackexchange/models.py +++ b/askbot/importers/stackexchange/models.py @@ -264,3 +264,7 @@ class VoteType(models.Model): name = models.CharField(max_length=50, null=True) description = models.CharField(max_length=300, null=True) +class Password(models.Model): + id = models.IntegerField(primary_key = True) + password = models.CharField(max_length = 128) + salt = models.CharField(max_length = 32) -- cgit v1.2.3-1-g7c22