Sprox and TG2

While playing around with Sprox and TG2, I found a little bug for which a fix is commited to Sprox, but not yet released. I had to a bit until I found a nice and easy workaround. I just copied the changed code into a Mixin class, which can be patched into the declarative Sprox classes.

class ValidateMixin(object):
    def validate(self, params, state=None):
        """A pass-thru to the widget's validate function."""
        return self.__widget__.validate(params, state)

It can be used with any Formbase class. Just inherit from ValidateMixin first:

class PostEditForm(ValidateMixin, EditableForm):
    pass

This works until a new version of Sprox is released and should continue to do so afterwards, even if it can be removed than.

Leave a Reply