~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/readonly.py

  • Committer: Patch Queue Manager
  • Date: 2016-01-31 13:36:59 UTC
  • mfrom: (6613.1.5 1538480-match-hostname)
  • Revision ID: pqm@pqm.ubuntu.com-20160131133659-ouy92ee2wlv9xz8m
(vila) Use ssl.match_hostname instead of our own. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2009 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009, 2010, 2011, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
"""Implementation of Transport that adapts another transport to be readonly."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
from bzrlib.errors import TransportNotPossible, NoSmartMedium
20
22
from bzrlib.transport import decorator
21
23
 
39
41
        """Readonly transport decorators are invoked via 'readonly+'"""
40
42
        return 'readonly+'
41
43
 
 
44
    def rename(self, rel_from, rel_to):
 
45
        """See Transport.rename."""
 
46
        raise TransportNotPossible('readonly transport')
 
47
 
42
48
    def delete(self, relpath):
43
49
        """See Transport.delete()."""
44
50
        raise TransportNotPossible('readonly transport')
59
65
        """See Transport.mkdir()."""
60
66
        raise TransportNotPossible('readonly transport')
61
67
 
 
68
    def open_write_stream(self, relpath, mode=None):
 
69
        """See Transport.open_write_stream()."""
 
70
        raise TransportNotPossible('readonly transport')
 
71
 
62
72
    def is_readonly(self):
63
73
        """See Transport.is_readonly."""
64
74
        return True
72
82
        raise TransportNotPossible('readonly transport')
73
83
 
74
84
    def get_smart_client(self):
75
 
        raise NoSmartServer(self.base)
 
85
        raise NoSmartMedium(self)
76
86
 
77
87
    def get_smart_medium(self):
78
88
        raise NoSmartMedium(self)
81
91
def get_test_permutations():
82
92
    """Return the permutations to be used in testing."""
83
93
    from bzrlib.tests import test_server
84
 
    return [(ReadonlyTransportDecorator, test_server.ReadonlyServer),]
 
94
    return [(ReadonlyTransportDecorator, test_server.ReadonlyServer)]