eventray/horus — pull request #13 by nandoflorestan (2012-09-03 23:23:09+00:00)
Title: Experiment: use Pyramid's wrapping feature

I was thinking I wanted an easy way to just make my website's
header, footer, columns etc. appear around Horus' forms.

I realized Pyramid has a *wrapper='some_view_name'* keyword
to a view configuration which can be used for this.

This branch is an experiment in using *wrapper*.

Users of Horus would simply:

1) implement a single template and view (the wrapper)
2) redeclare the view configuration of Horus' views.

The second step can even be provided by Horus itself, in the
form of a function that takes the wrapper's name as a parameter.
So the user can make a single function call.

In any case, the source code in this branch already shows how
*wrapper* works, through the horus_wrapper() view and the
template "wrapper.mako". Every template has been reduced to its
core, and the boilerplate is in this new wrapper.mako.

Advantages of this approach:

- We are just using Pyramid.
- The outer app can use *any* templating language. (I prefer Genshi.)

Disadvantage:

- Performance is sub-optimal because the wrapped
response body -- a bytestring -- has to be decoded, included in
the template, then everything is encoded again. Unless I am
missing something here (quite possible), it would be nicer to use
*a proper layout system*. Ptah seems to have one...

Thoughts?