~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/vfs.py

  • Committer: Mark Hammond
  • Date: 2009-01-12 01:55:34 UTC
  • mto: (3995.8.2 prepare-1.12)
  • mto: This revision was merged to the branch mainline in revision 4007.
  • Revision ID: mhammond@skippinet.com.au-20090112015534-yfxg50p7mpds9j4v
Include all .html files from the tortoise doc directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""VFS operations for the smart server.
18
18
 
27
27
import os
28
28
 
29
29
from bzrlib import errors
30
 
from bzrlib import urlutils
31
30
from bzrlib.smart import request
32
31
 
33
32
 
52
51
 
53
52
class VfsRequest(request.SmartServerRequest):
54
53
    """Base class for VFS requests.
55
 
 
 
54
    
56
55
    VFS requests are disabled if vfs_enabled() returns False.
57
56
    """
58
57
 
60
59
        if not vfs_enabled():
61
60
            raise errors.DisabledMethod(self.__class__.__name__)
62
61
 
63
 
    def translate_client_path(self, relpath):
64
 
        # VFS requests are made with escaped paths so the escaping done in
65
 
        # SmartServerRequest.translate_client_path leads to double escaping.
66
 
        # Remove it here -- the fact that the result is still escaped means
67
 
        # that the str() will not fail on valid input.
68
 
        x = request.SmartServerRequest.translate_client_path(self, relpath)
69
 
        return str(urlutils.unescape(x))
70
 
 
71
62
 
72
63
class HasRequest(VfsRequest):
73
64
 
91
82
        relpath = self.translate_client_path(relpath)
92
83
        self._relpath = relpath
93
84
        self._mode = _deserialise_optional_mode(mode)
94
 
 
 
85
    
95
86
    def do_body(self, body_bytes):
96
87
        old_length = self._backing_transport.append_bytes(
97
88
            self._relpath, body_bytes, self._mode)