Merge lp://staging/~spiv/loggerhead/branchwsgiapp-refactor into lp://staging/loggerhead

Proposed by Andrew Bennetts
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 450
Merged at revision: 450
Proposed branch: lp://staging/~spiv/loggerhead/branchwsgiapp-refactor
Merge into: lp://staging/loggerhead
Diff against target: 90 lines (+22/-13)
2 files modified
loggerhead/apps/branch.py (+6/-3)
loggerhead/controllers/__init__.py (+16/-10)
To merge this branch: bzr merge lp://staging/~spiv/loggerhead/branchwsgiapp-refactor
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+66143@code.staging.launchpad.net

Commit message

Refactor BranchWSGIApp.app and TemplatedBranchView.__call__ a little.

Description of the change

These are some refactorings introduced in lp:~spiv/loggerhead/jsonify.

It extracts a lookup_app method from BranchWSGIApp.app, for better testability.

It also extracts parse_args and add_template_values methods from TemplatedBranchView.__call__. These are also useful for writing unit tests.

There are some small behaviour changes, but we think they're ok:

 * BranchWSGIApp.app holds a branch lock read from earlier, and even does so for static files. However read locks are cheap, and in fact this will bring a branch.get_config() call inside the read lock which is probably a good thing.
 * add_template_values now overrides values from get_values rather than the other way around. In practice they are always the same (and the jsonify branch will remove many of the unnecessary duplication of these values).

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches