~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/base/rest.py

  • Committer: William Grant
  • Date: 2010-02-18 03:31:47 UTC
  • Revision ID: grantw@unimelb.edu.au-20100218033147-z1es9tzrx7eg85gu
Ensure that we always close the DB connection at request termination, even in the case of an exception.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import genshi.template
27
27
 
28
28
from ivle.webapp.base.views import BaseView
29
 
from ivle.webapp.base.xhtml import GenshiLoaderMixin
30
29
from ivle.webapp.errors import BadRequest, MethodNotAllowed, Unauthorized
31
30
 
32
31
class RESTView(BaseView):
150
149
            req.write("\n")
151
150
 
152
151
 
153
 
class XHTMLRESTView(GenshiLoaderMixin, JSONRESTView):
 
152
class XHTMLRESTView(JSONRESTView):
154
153
    """A special type of RESTView which takes enhances the standard JSON
155
154
    with genshi XHTML functions.
156
155
    
165
164
 
166
165
        rest_template = os.path.join(os.path.dirname(
167
166
                inspect.getmodule(self).__file__), self.template)
168
 
        tmpl = self._loader.load(rest_template)
 
167
        loader = genshi.template.TemplateLoader(".", auto_reload=True)
 
168
        tmpl = loader.load(rest_template)
169
169
 
170
170
        return tmpl.generate(self.ctx).render('xhtml', doctype='xhtml')
171
171