Added validation processes for reddit accounts

This commit is contained in:
2010-04-02 19:32:57 +01:00
parent 795066dfaa
commit 83a9113127
3 changed files with 19 additions and 9 deletions

View File

@@ -52,20 +52,21 @@ class APIKeyParser:
def __str__(self):
return "%s:%s" % (self.user_id, self.api_key)
class ProcessInbox():
class ProcessValidations():
"""
Grabs all Reddit Mail and processes any new applications
Grabs all Reddit Mail and processes validations
"""
def job(self):
inbox = Inbox(settings.REDDIT_USER, settings.REDDIT_PASSWORD)
inbox = Inbox(settings.REDDIT_USER, settings.REDDIT_PASSWD)
for msg in inbox:
if not msg.was_comment and msg.new:
try:
key = APIKeyParser(msg.body)
except:
pass
else:
print key.username
acc = RedditAccount.objects.get(username_iexact=msg.username)
if not acc.validated and msg.body == acc.user.username:
acc.validated = True
acc.save()
except RedditAccount.DoesNotExist:
continue