~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/apps/branch.py

[rs=thumper] merge loggerhead trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from loggerhead import util
24
24
 
25
25
 
 
26
_DEFAULT = object()
 
27
 
26
28
class BranchWSGIApp(object):
27
29
 
28
30
    def __init__(self, branch, friendly_name=None, config={},
29
 
                 graph_cache=None, branch_link=None, is_root=False):
 
31
                 graph_cache=None, branch_link=None, is_root=False,
 
32
                 served_url=_DEFAULT):
30
33
        self.branch = branch
31
34
        self._config = config
32
35
        self.friendly_name = friendly_name
36
39
            graph_cache = bzrlib.lru_cache.LRUCache()
37
40
        self.graph_cache = graph_cache
38
41
        self.is_root = is_root
 
42
        self.served_url = served_url
39
43
 
40
44
    def get_history(self):
41
45
        _history = History(self.branch, self.graph_cache)
63
67
        qs = '&'.join(qs)
64
68
        return request.construct_url(
65
69
            self._environ, script_name=self._url_base,
66
 
            path_info='/'.join(args),
 
70
            path_info=unicode('/'.join(args)).encode('utf-8'),
67
71
            querystring=qs)
68
72
 
69
73
    def context_url(self, *args, **kw):
98
102
        if self._static_url_base is None:
99
103
            self._static_url_base = self._url_base
100
104
        self._environ = environ
 
105
        if self.served_url is _DEFAULT:
 
106
            self.served_url = self.url([])
101
107
        path = request.path_info_pop(environ)
102
108
        if not path:
103
109
            raise httpexceptions.HTTPMovedPermanently(