Merge lp:~james-w/launchpad/move-file-is-a-directory into lp:launchpad

Proposed by James Westby
Status: Merged
Merged at revision: 11148
Proposed branch: lp:~james-w/launchpad/move-file-is-a-directory
Merge into: lp:launchpad
Diff against target: 107 lines (+16/-13)
5 files modified
lib/lp/codehosting/sftp.py (+1/-10)
lib/lp/codehosting/tests/test_sftp.py (+2/-1)
lib/lp/poppy/tests/test_twistedsftp.py (+1/-1)
lib/lp/poppy/twistedsftp.py (+1/-1)
lib/lp/services/sshserver/sftp.py (+11/-0)
To merge this branch: bzr merge lp:~james-w/launchpad/move-file-is-a-directory
Reviewer Review Type Date Requested Status
Paul Hummer (community) code Approve
Review via email: mp+29033@code.launchpad.net

Commit message

Make poppy stop depending on codehosting by moving FileIsADirectory to lp.services.sshserver

Description of the change

Hi,

This is a small branch to stop lp.poppy depending on lp.codehosting.

There's no real need for this soyuzy thing to depend on codehosting, it
was just convenience of reusing an error.

It has the slightly unfortunate side-effects of making lp.codehosting.sftp
depend on lp.services.sshserver, and lp.services.sshserver depend on bzr,
however those dependencies are at least in the right direction.

Tests:
./bin/test -s lp.poppy
./bin/test -s lp.codehosting.tests -m test_sftp

Linting changed files:
  lib/lp/codehosting/sftp.py
  lib/lp/codehosting/tests/test_sftp.py
  lib/lp/poppy/twistedsftp.py
  lib/lp/poppy/tests/test_twistedsftp.py
  lib/lp/services/sshserver/sftp.py

== Pyflakes notices ==

lib/lp/poppy/twistedsftp.py
    19: 'zope' imported but unused
'import site' failed; use -v for traceback
Exception RuntimeError: 'maximum recursion depth exceeded while calling a Python object' in <type 'exceptions.RuntimeError'> ignored
Exception RuntimeError: 'maximum recursion depth exceeded while calling a Python object' in <type 'exceptions.RuntimeError'> ignored
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.AttributeError'> ignored
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.AttributeError'> ignored

== Pylint notices ==

lib/lp/poppy/twistedsftp.py
    19: [W0611] Unused import zope

lib/lp/poppy/tests/test_twistedsftp.py
    19: [E1002, TestSFTPServer.setUp] Use super on an old style class

Thanks,

James

To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) wrote :

A big +1 from me!

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/codehosting/sftp.py'
--- lib/lp/codehosting/sftp.py 2010-05-28 08:42:47 +0000
+++ lib/lp/codehosting/sftp.py 2010-07-16 19:49:41 +0000
@@ -16,7 +16,6 @@
16__all__ = [16__all__ = [
17 'avatar_to_sftp_server',17 'avatar_to_sftp_server',
18 'TransportSFTPServer',18 'TransportSFTPServer',
19 'FileIsADirectory',
20 ]19 ]
2120
2221
@@ -38,18 +37,10 @@
3837
39from canonical.config import config38from canonical.config import config
40from lp.codehosting.vfs import AsyncLaunchpadTransport, LaunchpadServer39from lp.codehosting.vfs import AsyncLaunchpadTransport, LaunchpadServer
40from lp.services.sshserver.sftp import FileIsADirectory
41from lp.services.twistedsupport import gatherResults41from lp.services.twistedsupport import gatherResults
4242
4343
44class FileIsADirectory(bzr_errors.PathError):
45 """Raised when writeChunk is called on a directory.
46
47 This exists mainly to be translated into the appropriate SFTP error.
48 """
49
50 _fmt = 'File is a directory: %(path)r%(extra)s'
51
52
53class FatLocalTransport(LocalTransport):44class FatLocalTransport(LocalTransport):
54 """A Bazaar transport that also implements writeChunk and local_realPath.45 """A Bazaar transport that also implements writeChunk and local_realPath.
5546
5647
=== modified file 'lib/lp/codehosting/tests/test_sftp.py'
--- lib/lp/codehosting/tests/test_sftp.py 2010-04-19 10:56:23 +0000
+++ lib/lp/codehosting/tests/test_sftp.py 2010-07-16 19:49:41 +0000
@@ -24,8 +24,9 @@
2424
25from lp.codehosting.inmemory import InMemoryFrontend, XMLRPCWrapper25from lp.codehosting.inmemory import InMemoryFrontend, XMLRPCWrapper
26from lp.codehosting.sftp import (26from lp.codehosting.sftp import (
27 FatLocalTransport, TransportSFTPServer, FileIsADirectory)27 FatLocalTransport, TransportSFTPServer)
28from lp.codehosting.sshserver.daemon import CodehostingAvatar28from lp.codehosting.sshserver.daemon import CodehostingAvatar
29from lp.services.sshserver.sftp import FileIsADirectory
29from lp.testing.factory import LaunchpadObjectFactory30from lp.testing.factory import LaunchpadObjectFactory
30from canonical.testing.layers import TwistedLayer31from canonical.testing.layers import TwistedLayer
3132
3233
=== modified file 'lib/lp/poppy/tests/test_twistedsftp.py'
--- lib/lp/poppy/tests/test_twistedsftp.py 2010-05-28 12:35:42 +0000
+++ lib/lp/poppy/tests/test_twistedsftp.py 2010-07-16 19:49:41 +0000
@@ -9,8 +9,8 @@
9import tempfile9import tempfile
10import unittest10import unittest
1111
12from lp.codehosting.sftp import FileIsADirectory
13from lp.poppy.twistedsftp import SFTPServer12from lp.poppy.twistedsftp import SFTPServer
13from lp.services.sshserver.sftp import FileIsADirectory
14from lp.testing import TestCase14from lp.testing import TestCase
1515
1616
1717
=== modified file 'lib/lp/poppy/twistedsftp.py'
--- lib/lp/poppy/twistedsftp.py 2010-05-28 12:35:42 +0000
+++ lib/lp/poppy/twistedsftp.py 2010-07-16 19:49:41 +0000
@@ -19,10 +19,10 @@
19import zope.component.event19import zope.component.event
20from zope.interface import implements20from zope.interface import implements
2121
22from lp.codehosting.sftp import FileIsADirectory
23from lp.poppy.filesystem import UploadFileSystem22from lp.poppy.filesystem import UploadFileSystem
24from lp.poppy.hooks import Hooks23from lp.poppy.hooks import Hooks
25from lp.services.sshserver.events import SFTPClosed24from lp.services.sshserver.events import SFTPClosed
25from lp.services.sshserver.sftp import FileIsADirectory
2626
2727
28class SFTPServer:28class SFTPServer:
2929
=== modified file 'lib/lp/services/sshserver/sftp.py'
--- lib/lp/services/sshserver/sftp.py 2010-04-15 15:49:05 +0000
+++ lib/lp/services/sshserver/sftp.py 2010-07-16 19:49:41 +0000
@@ -5,9 +5,11 @@
55
6__metaclass__ = type6__metaclass__ = type
7__all__ = [7__all__ = [
8 'FileIsADirectory',
8 'FileTransferServer',9 'FileTransferServer',
9 ]10 ]
1011
12from bzrlib import errors as bzr_errors
11from twisted.conch.ssh import filetransfer13from twisted.conch.ssh import filetransfer
1214
13from zope.event import notify15from zope.event import notify
@@ -15,6 +17,15 @@
15from lp.services.sshserver import events17from lp.services.sshserver import events
1618
1719
20class FileIsADirectory(bzr_errors.PathError):
21 """Raised when writeChunk is called on a directory.
22
23 This exists mainly to be translated into the appropriate SFTP error.
24 """
25
26 _fmt = 'File is a directory: %(path)r%(extra)s'
27
28
18class FileTransferServer(filetransfer.FileTransferServer):29class FileTransferServer(filetransfer.FileTransferServer):
19 """SFTP protocol implementation that logs key events."""30 """SFTP protocol implementation that logs key events."""
2031