def _to_yt_user(self, redmine_user):
        if isinstance(redmine_user, basestring):
            user_id = redmine_user
        else:
            user_id = redmine_user.id
        if user_id not in self._users:
            redmine_user = self._source.get_user(user_id)
            user = youtrack.User()
            try:
                user.email = redmine_user.mail
            except __HOLE__:
                pass
            try:
                # In some cases redmine user login can be empty or missing.
                # So, both cases should be handled.
                user.login = redmine_user.login
            except AttributeError:
                pass
            if not hasattr(user, 'login') or not user.login:
                if hasattr(user, 'email'):
                    user.login = user.email
                else:
                    user.login = 'guest'
                print 'Cannot get login for user id=%s, set it to "%s"' % \
                    (user_id, user.login)
            #user.login = redmine_user.login or 'guest'
            #user.email = redmine_user.mail or 'example@example.com'
            if user.login != 'guest':
                if redmine_user.firstname is None and redmine_user.lastname is None:
                    user.fullName = user.login
                elif redmine_user.firstname is None:
                    user.fullName = redmine_user.lastname
                elif redmine_user.lastname is None:
                    user.fullName = redmine_user.firstname
                else:
                    user.fullName = redmine_user.firstname + ' ' + redmine_user.lastname
            else:
                user.created = True
            if hasattr(redmine_user, 'groups'):
                user.groups = [self._to_yt_group(g) for g in redmine_user.groups]
            self._users[user_id] = user
        return self._users[user_id]
dataset/ETHPy150Open JetBrains/youtrack-rest-python-library/python/redmine2youtrack.py/RedmineImporter._to_yt_user