~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/remote.py

  • Committer: Andrew Bennetts
  • Date: 2008-04-07 08:17:38 UTC
  • mto: This revision was merged to the branch mainline in revision 3349.
  • Revision ID: andrew.bennetts@canonical.com-20080407081738-yx4c53pvqfif313d
SmartClientRequestProtocol*.read_response_tuple can now raise UnknownSmartMethod.  Callers no longer need to do their own ad hoc unknown smart method error detection.

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
 
122
122
    def is_readonly(self):
123
123
        """Smart server transport can do read/write file operations."""
124
 
        resp = self._call2('Transport.is_readonly')
125
 
        if resp == ('yes', ):
126
 
            return True
127
 
        elif resp == ('no', ):
128
 
            return False
129
 
        elif (resp == ('error', "Generic bzr smart protocol error: "
130
 
                                "bad request 'Transport.is_readonly'") or
131
 
              resp == ('error', "Generic bzr smart protocol error: "
132
 
                                "bad request u'Transport.is_readonly'")):
 
124
        try:
 
125
            resp = self._call2('Transport.is_readonly')
 
126
        except errors.UnknownSmartMethod:
133
127
            # XXX: nasty hack: servers before 0.16 don't have a
134
128
            # 'Transport.is_readonly' verb, so we do what clients before 0.16
135
129
            # did: assume False.
136
130
            return False
 
131
        if resp == ('yes', ):
 
132
            return True
 
133
        elif resp == ('no', ):
 
134
            return False
137
135
        else:
138
136
            self._translate_error(resp)
139
137
        raise errors.UnexpectedSmartServerResponse(resp)