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
1=== modified file 'lib/lp/codehosting/sftp.py'
2--- lib/lp/codehosting/sftp.py 2010-05-28 08:42:47 +0000
3+++ lib/lp/codehosting/sftp.py 2010-07-16 19:49:41 +0000
4@@ -16,7 +16,6 @@
5 __all__ = [
6 'avatar_to_sftp_server',
7 'TransportSFTPServer',
8- 'FileIsADirectory',
9 ]
10
11
12@@ -38,18 +37,10 @@
13
14 from canonical.config import config
15 from lp.codehosting.vfs import AsyncLaunchpadTransport, LaunchpadServer
16+from lp.services.sshserver.sftp import FileIsADirectory
17 from lp.services.twistedsupport import gatherResults
18
19
20-class 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-
29 class FatLocalTransport(LocalTransport):
30 """A Bazaar transport that also implements writeChunk and local_realPath.
31
32
33=== modified file 'lib/lp/codehosting/tests/test_sftp.py'
34--- lib/lp/codehosting/tests/test_sftp.py 2010-04-19 10:56:23 +0000
35+++ lib/lp/codehosting/tests/test_sftp.py 2010-07-16 19:49:41 +0000
36@@ -24,8 +24,9 @@
37
38 from lp.codehosting.inmemory import InMemoryFrontend, XMLRPCWrapper
39 from lp.codehosting.sftp import (
40- FatLocalTransport, TransportSFTPServer, FileIsADirectory)
41+ FatLocalTransport, TransportSFTPServer)
42 from lp.codehosting.sshserver.daemon import CodehostingAvatar
43+from lp.services.sshserver.sftp import FileIsADirectory
44 from lp.testing.factory import LaunchpadObjectFactory
45 from canonical.testing.layers import TwistedLayer
46
47
48=== modified file 'lib/lp/poppy/tests/test_twistedsftp.py'
49--- lib/lp/poppy/tests/test_twistedsftp.py 2010-05-28 12:35:42 +0000
50+++ lib/lp/poppy/tests/test_twistedsftp.py 2010-07-16 19:49:41 +0000
51@@ -9,8 +9,8 @@
52 import tempfile
53 import unittest
54
55-from lp.codehosting.sftp import FileIsADirectory
56 from lp.poppy.twistedsftp import SFTPServer
57+from lp.services.sshserver.sftp import FileIsADirectory
58 from lp.testing import TestCase
59
60
61
62=== modified file 'lib/lp/poppy/twistedsftp.py'
63--- lib/lp/poppy/twistedsftp.py 2010-05-28 12:35:42 +0000
64+++ lib/lp/poppy/twistedsftp.py 2010-07-16 19:49:41 +0000
65@@ -19,10 +19,10 @@
66 import zope.component.event
67 from zope.interface import implements
68
69-from lp.codehosting.sftp import FileIsADirectory
70 from lp.poppy.filesystem import UploadFileSystem
71 from lp.poppy.hooks import Hooks
72 from lp.services.sshserver.events import SFTPClosed
73+from lp.services.sshserver.sftp import FileIsADirectory
74
75
76 class SFTPServer:
77
78=== modified file 'lib/lp/services/sshserver/sftp.py'
79--- lib/lp/services/sshserver/sftp.py 2010-04-15 15:49:05 +0000
80+++ lib/lp/services/sshserver/sftp.py 2010-07-16 19:49:41 +0000
81@@ -5,9 +5,11 @@
82
83 __metaclass__ = type
84 __all__ = [
85+ 'FileIsADirectory',
86 'FileTransferServer',
87 ]
88
89+from bzrlib import errors as bzr_errors
90 from twisted.conch.ssh import filetransfer
91
92 from zope.event import notify
93@@ -15,6 +17,15 @@
94 from lp.services.sshserver import events
95
96
97+class FileIsADirectory(bzr_errors.PathError):
98+ """Raised when writeChunk is called on a directory.
99+
100+ This exists mainly to be translated into the appropriate SFTP error.
101+ """
102+
103+ _fmt = 'File is a directory: %(path)r%(extra)s'
104+
105+
106 class FileTransferServer(filetransfer.FileTransferServer):
107 """SFTP protocol implementation that logs key events."""
108