Exemplo n.º 1
0
    def gen_profile():
        logger.info(f"Transferring profiles")

        elapsed, progress = timer_func()

        # Allow limiting the input
        stream = islice(zip(count(1), old_users), limit)
        for index, user in stream:
            progress(index, msg="profiles")
            text = util.strip_tags(user.profile.info)

            # The incoming users have weekly digest prefs as a default.
            #digest_prefs = Profile.NO_DIGEST if user.profile.digest_prefs == Profile.WEEKLY_DIGEST else user.profile.digest_prefs
            profile = Profile(uid=user.id,
                              user=current.get(user.email),
                              name=user.name,
                              message_prefs=user.profile.message_prefs,
                              role=user.type,
                              last_login=user.last_login,
                              html=user.profile.info,
                              date_joined=user.profile.date_joined,
                              location=user.profile.location,
                              website=user.profile.website,
                              scholar=user.profile.scholar,
                              text=text,
                              score=user.score,
                              twitter=user.profile.twitter_id,
                              my_tags=user.profile.my_tags,
                              digest_prefs=user.profile.digest_prefs,
                              new_messages=user.new_messages)

            yield profile
Exemplo n.º 2
0
    def gen_profile():
        logger.info(f"Transferring profiles")

        # Exclude existing users from source database.
        users = UsersUser.objects.all().order_by("id")

        elapsed, progress = timer_func()

        # Allow limiting the input
        stream = islice(zip(count(1), users), limit)
        for index, user in stream:
            progress(index, msg="profiles")
            text = util.strip_tags(user.profile.info)

            profile = Profile(uid=user.id,
                              user=current.get(user.email),
                              name=user.name,
                              role=user.type,
                              last_login=user.last_login,
                              html=user.profile.info,
                              date_joined=user.profile.date_joined,
                              location=user.profile.location,
                              website=user.profile.website,
                              scholar=user.profile.scholar,
                              text=text,
                              score=user.score,
                              twitter=user.profile.twitter_id,
                              my_tags=user.profile.my_tags,
                              digest_prefs=user.profile.digest_prefs,
                              new_messages=user.new_messages)

            yield profile