~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/vfs.py

  • Committer: Ian Clatworthy
  • Date: 2008-04-01 04:19:06 UTC
  • mfrom: (3302.6.1 xma-mailmode)
  • mto: This revision was merged to the branch mainline in revision 3323.
  • Revision ID: ian.clatworthy@canonical.com-20080401041906-s7ekpfpo0tnyfkbz
Add mail-mode GNU Emacs mail package as a mail client option (Xavier Maillard)

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
 
51
51
 
52
52
class VfsRequest(request.SmartServerRequest):
53
53
    """Base class for VFS requests.
54
 
 
 
54
    
55
55
    VFS requests are disabled if vfs_enabled() returns False.
56
56
    """
57
57
 
72
72
 
73
73
    def do(self, relpath):
74
74
        relpath = self.translate_client_path(relpath)
75
 
        backing_bytes = self._backing_transport.get_bytes(relpath)
 
75
        try:
 
76
            backing_bytes = self._backing_transport.get_bytes(relpath)
 
77
        except errors.ReadError:
 
78
            # cannot read the file
 
79
            return request.FailedSmartServerResponse(('ReadError', ))
 
80
        except errors.PermissionDenied:
 
81
            return request.FailedSmartServerResponse(('PermissionDenied',))
76
82
        return request.SuccessfulSmartServerResponse(('ok',), backing_bytes)
77
83
 
78
84
 
82
88
        relpath = self.translate_client_path(relpath)
83
89
        self._relpath = relpath
84
90
        self._mode = _deserialise_optional_mode(mode)
85
 
 
 
91
    
86
92
    def do_body(self, body_bytes):
87
93
        old_length = self._backing_transport.append_bytes(
88
94
            self._relpath, body_bytes, self._mode)