~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/apps/branch.py

  • Committer: Marius Kruger
  • Date: 2008-10-01 22:30:30 UTC
  • mto: This revision was merged to the branch mainline in revision 229.
  • Revision ID: amanic@gmail.com-20081001223030-xlk4q8ct7egl3utf
add news

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
import logging
4
4
import urllib
 
5
import sys
5
6
 
6
7
import bzrlib.branch
7
8
import bzrlib.lru_cache
17
18
from loggerhead.controllers.atom_ui import AtomUI
18
19
from loggerhead.controllers.download_ui import DownloadUI
19
20
from loggerhead.controllers.search_ui import SearchUI
 
21
from loggerhead.controllers.diff_ui import DiffUI
20
22
from loggerhead.history import History
21
23
from loggerhead import util
22
24
 
24
26
class BranchWSGIApp(object):
25
27
 
26
28
    def __init__(self, branch, friendly_name=None, config={},
27
 
                 graph_cache=None, branch_link=None):
 
29
                 graph_cache=None, branch_link=None, is_root=False):
28
30
        self.branch = branch
29
31
        self._config = config
30
32
        self.friendly_name = friendly_name
33
35
        if graph_cache is None:
34
36
            graph_cache = bzrlib.lru_cache.LRUCache()
35
37
        self.graph_cache = graph_cache
 
38
        self.is_root = is_root
36
39
 
37
40
    def get_history(self):
38
41
        _history = History(self.branch, self.graph_cache)
78
81
        'download': DownloadUI,
79
82
        'atom': AtomUI,
80
83
        'search': SearchUI,
 
84
        'diff': DiffUI,
81
85
        }
82
86
 
83
87
    def last_updated(self):
107
111
        try:
108
112
            c = cls(self, self.get_history())
109
113
            return c(environ, start_response)
 
114
        except:
 
115
            environ['exc_info'] = sys.exc_info()
 
116
            environ['branch'] = self
 
117
            raise
110
118
        finally:
111
119
            self.branch.unlock()