def validate(self, session):
        """
        Validate that the current user can be saved.

        :param session: SQLAlchemy session
        :type session: :class:`sqlalchemy.Session`

        :return: ``True``
        :rtype: bool

        :raise: :class:`pyshop.helpers.sqla.ModelError` if user is not valid
        """

        errors = []
        if not self.login:
            errors.append(u'login is required')
        else:
            other = User.by_login(session, self.login)
            if other and other.id != self.id:
                errors.append(u'duplicate login %s' % self.login)
        if not self.password:
            errors.append(u'password is required')
        if not self.email:
            errors.append(u'email is required')
        elif not re_email.match(self.email):
            errors.append(self.email % u'%s is not a valid email')

        if len(errors):
            raise ModelError(errors)
        return True
dataset/ETHPy150Open mardiros/pyshop/pyshop/models.py/User.validate/swapped operands of `%`