/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/ftp_server.py

Fixed as per John's review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
    """A custom filesystem wrapper to add missing functionalities."""
42
42
 
43
43
    def chmod(self, path, mode):
44
 
        p = self.normalize (self.path_module.join (self.wd, path))
 
44
        p = self.normalize(self.path_module.join (self.wd, path))
45
45
        return os.chmod(self.translate(p), mode)
46
46
 
47
47
 
48
 
 
49
48
class test_authorizer(object):
50
49
    """A custom Authorizer object for running the test suite.
51
50
 
163
162
                self.respond ('550 error creating directory.')
164
163
 
165
164
    def cmd_site(self, line):
 
165
        """Site specific commands."""
166
166
        command, args = line[1].split(' ', 1)
167
167
        if command.lower() == 'chmod':
168
168
            try:
169
169
                mode, path = args.split()
170
170
                mode = int(mode, 8)
171
171
            except ValueError:
 
172
                # We catch both malformed line and malformed mode with the same
 
173
                # ValueError.
172
174
                self.command_not_understood(' '.join(line))
173
175
                return
174
176
            try:
176
178
                self.filesystem.chmod(path, mode)
177
179
                self.respond('200 SITE CHMOD command successful')
178
180
            except AttributeError:
179
 
                # The chmod method is not available in read-only
 
181
                # The chmod method is not available in read-only and will raise
 
182
                # AttributeError since a different filesystem is used in that
 
183
                # case
180
184
                self.command_not_authorized(' '.join(line))
181
185
        else:
 
186
            # Another site specific command was requested. We don't know that
 
187
            # one
182
188
            self.command_not_understood(' '.join(line))
183
189
 
184
190