I have set up an issue with a more concrete proposal for better separation of concerns in the templates.

https://github.com/ledgersmb/LedgerSMB/issues/3108

I believe this would allow us to isolate PSGI and CGI-related code in one or two places only (request parsing and the request wrappers) for new code and break them entirely out of the template's responsibility.

--
Best Wishes,
Chris Travers

Efficito:  Hosted Accounting and ERP.  Robust and Flexible.  No vendor lock-in.
http://www.efficito.com/learn_more