~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/apps/branch.py

  • Committer: Andrew Bennetts
  • Date: 2011-06-28 13:13:05 UTC
  • Revision ID: andrew.bennetts@canonical.com-20110628131305-skv4h2z02z3iw8wc
Extract some refactoring of TemplatedBranchView and BranchWSGIApp from the jsonify branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
    def public_branch_url(self):
137
137
        return self.branch.get_config().get_user_option('public_branch')
138
138
 
139
 
    def app(self, environ, start_response):
 
139
    def lookup_app(self, environ):
140
140
        # Check again if the branch is blocked from being served, this is
141
141
        # mostly for tests. It's already checked in apps/transport.py
142
142
        if self.branch.get_config().get_user_option('http_serve') == 'False':
163
163
            raise httpexceptions.HTTPMovedPermanently(
164
164
                self.absolute_url('/changes'))
165
165
        if path == 'static':
166
 
            return static_app(environ, start_response)
 
166
            return static_app
167
167
        cls = self.controllers_dict.get(path)
168
168
        if cls is None:
169
169
            raise httpexceptions.HTTPNotFound()
 
170
        return cls(self, self.get_history)
 
171
 
 
172
    def app(self, environ, start_response):
170
173
        self.branch.lock_read()
171
174
        try:
172
175
            try:
173
 
                c = cls(self, self.get_history)
 
176
                c = self.lookup_app(environ)
174
177
                return c(environ, start_response)
175
178
            except:
176
179
                environ['exc_info'] = sys.exc_info()