Mustache for Flask

e.g.


    from flask import Flask
    from pystache import View
    from flaskext.mustache import viewroute, viewerror

    app = Flask(__name__)

    @viewroute(app, '/example/<dynamic>')
    class Example(View):

        """
        An example view
        """

        def __init__(self, *args, **kwargs):
            super(Example, self).__init__(*args, **kwargs)
            self.template = "{{hello}}{{dynamic}}"

        def hello(self):
            return "hello"

        def dynamic(self):
            return self.route_args.get('dynamic')

    @viewerror(self.app, 404, *args, **kwargs)
    class Example404(View):

        """
        An example 404 view
        """

        def __init__(self, *args, **kwargs):
            super(Example404, self).__init__(*args, **kwargs)
            self.template = "{{hello}}"

        def hello(self):
            return "hello 404"

    @viewerror(self.app, NotImplementedError, 501, *args, **kwargs)
    class ExampleCustomCode(View):

        """
        An example Exception view
        """

        def __init__(self, *args, **kwargs):
            super(ExampleCustomCode, self).__init__(*args, **kwargs)
            self.template = "{{hello}}"

        def hello(self):
            return "hello custom code"
