@@ -0,0 +1,876 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22Script to migrate nodes with invalid categories.%22%22%22%0A%0Aimport sys%0Aimport logging%0A%0Afrom modularodm import Q%0A%0Afrom website.app import init_app%0Afrom website.models import User%0Afrom scripts import utils as script_utils%0A%0Alogger = logging.getLogger('fix_is_claimed')%0A%0A%0Adef main(dry=True):%0A    init_app(set_backends=True, routes=False)%0A    count = 0%0A    for user in User.find(Q('is_claimed', 'eq', None)):%0A        is_claimed = bool(user.date_confirmed)%0A        logger.info('User %7B%7D: setting is_claimed to %7B%7D'.format(user._id, is_claimed))%0A        user.is_claimed = is_claimed%0A        count += 1%0A        if not dry:%0A            user.save()%0A    logger.info('Migrated %7B%7D users.'.format(count))%0A%0Aif __name__ == '__main__':%0A    dry = 'dry' in sys.argv%0A    if not dry:%0A        script_utils.add_file_logger(logger, __file__)%0A    main(dry=dry)%0A

Add migration script to migrate users whose is_claimed field is None