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

« back to all changes in this revision

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

  • Committer: Matt Giuca
  • Date: 2010-03-22 06:05:32 UTC
  • Revision ID: matt.giuca@gmail.com-20100322060532-5365361xrx9mh32v
Changed database.py get_svn_url to take a req; include the req.user.login in the Subversion URL. This allows you to check out repositories without separately supplying the IVLE URL (as Subversion won't ask for a username by default). Also removed --username= from the lecturer project view, as it's redundant now. This fixes Launchpad bug #543936.

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
29
30
from ivle.webapp.errors import BadRequest, MethodNotAllowed, Unauthorized
30
31
 
31
32
class RESTView(BaseView):
55
56
        if not hasattr(op, '_rest_api_permission'):
56
57
            raise Unauthorized()
57
58
 
58
 
        if op._rest_api_permission not in self.get_permissions(req.user):
 
59
        if (op._rest_api_permission not in
 
60
            self.get_permissions(req.user, req.config)):
59
61
            raise Unauthorized()
60
62
    
61
63
    def convert_bool(self, value):
148
150
            req.write("\n")
149
151
 
150
152
 
151
 
class XHTMLRESTView(JSONRESTView):
 
153
class XHTMLRESTView(GenshiLoaderMixin, JSONRESTView):
152
154
    """A special type of RESTView which takes enhances the standard JSON
153
155
    with genshi XHTML functions.
154
156
    
163
165
 
164
166
        rest_template = os.path.join(os.path.dirname(
165
167
                inspect.getmodule(self).__file__), self.template)
166
 
        loader = genshi.template.TemplateLoader(".", auto_reload=True)
167
 
        tmpl = loader.load(rest_template)
 
168
        tmpl = self._loader.load(rest_template)
168
169
 
169
170
        return tmpl.generate(self.ctx).render('xhtml', doctype='xhtml')
170
171