# EMEN2 Extensions # **Note**: More to come... The EMEN2 web interface can be extended fairly easily. First, create a directory with the following structure: {{{ / /__init__.py /views/ /views/__init__.py /views/example.py /templates/ /templates/example/ /templates/example/example.mako }}} In example.py: {{{ from emen2.web.view import View @View.register class ExampleView(View): @View.add_matcher(r'^/example/square/(?P[^/]*)/$') def example_test(self, value): self.title = 'Example extension' self.template = '/example/example' value = int(value) self.ctxt['value'] = value self.ctxt['value_square'] = value ** 2 }}} In example.mako: {{{ <%inherit file="/page" />

Example

This is an example of how to create a view and template.

The value argument was: ${value}

The value argument squared is ${value_square}, or ${value**2}

}}} And finally, in /views/__init__.py: {{{ import example }}}