def handle(self, *args, **options): try: email_or_userid = args[0] except IndexError: raise CommandError("Pass user-id or email address as parameter.") try: u = User.objects.get(email=email_or_userid) except User.DoesNotExist: try: u = User.objects.get(id=email_or_userid) except User.DoesNotExist: raise CommandError("Could not find user with email or id '%s'." % email_or_userid) if sync_user(user=u): print "Successful."
def handle(self, *args, **options): for u in User.objects.all(): print "Synchronizing user %s / %s ..." % (u.id, u.email) if sync_user(user=u): print "Successful."
def run(self, user=None, user_id=None): sync_user(user=user, user_id=user_id) optin_user(user=user, user_id=user_id)