summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/git-tftpd2
-rw-r--r--src/git_tftpd/backend.py7
-rw-r--r--src/git_tftpd/writer.py5
-rw-r--r--src/twisted/plugins/git_tftpd_plugin.py6
4 files changed, 9 insertions, 11 deletions
diff --git a/bin/git-tftpd b/bin/git-tftpd
index 038932b..20cf01d 100755
--- a/bin/git-tftpd
+++ b/bin/git-tftpd
@@ -14,5 +14,5 @@ else
args=()
fi
-PYTHONPATH="$dir/../src/" twistd --logfile="$dir/../var/git-tftpd.log" \
+PYTHONPATH="$dir/../src/" twistd3 --logfile="$dir/../var/git-tftpd.log" \
--pidfile="$dir/../var/git-tftpd.pid" "${args[@]}" git-tftpd "$@"
diff --git a/src/git_tftpd/backend.py b/src/git_tftpd/backend.py
index 6fae5bd..2d45916 100644
--- a/src/git_tftpd/backend.py
+++ b/src/git_tftpd/backend.py
@@ -7,12 +7,11 @@ from tftp.util import deferred
from twisted.python.context import get
from twisted.python.filepath import FilePath, InsecurePath
-from zope import interface
+from zope.interface import implementer
+@implementer(IBackend)
class GitBackend(object):
- interface.implements(IBackend)
-
def __init__(self, base_path):
self.base_path = base_path
self.base = FilePath(base_path)
@@ -25,6 +24,6 @@ class GitBackend(object):
def get_writer(self, file_name):
try:
target_path = self.base.descendant(file_name.split("/"))
- except InsecurePath, e:
+ except InsecurePath as e:
raise AccessViolation("Insecure path: %s" % e)
return GitWriter(target_path, self.base_path, get('remote'))
diff --git a/src/git_tftpd/writer.py b/src/git_tftpd/writer.py
index bee731c..a181592 100644
--- a/src/git_tftpd/writer.py
+++ b/src/git_tftpd/writer.py
@@ -7,12 +7,11 @@ from .git import GitRepo
from tftp.backend import IWriter
from twisted.python import log
-from zope import interface
+from zope.interface import implementer
+@implementer(IWriter)
class GitWriter(object):
- interface.implements(IWriter)
-
def __init__(self, file_path, repo, remote):
file_dir = file_path.parent()
if not file_dir.exists():
diff --git a/src/twisted/plugins/git_tftpd_plugin.py b/src/twisted/plugins/git_tftpd_plugin.py
index 1d2b53e..a58ffed 100644
--- a/src/twisted/plugins/git_tftpd_plugin.py
+++ b/src/twisted/plugins/git_tftpd_plugin.py
@@ -6,7 +6,7 @@ from twisted.plugin import IPlugin
from twisted.application.service import IServiceMaker
from twisted.application import internet
-from zope.interface import implements
+from zope.interface import implementer
class Options(usage.Options):
optParameters = [
@@ -15,15 +15,15 @@ class Options(usage.Options):
]
+@implementer(IServiceMaker, IPlugin)
class MyServiceMaker(object):
- implements(IServiceMaker, IPlugin)
tapname = 'git-tftpd'
description = 'A tftp server, that commits the files into a git repo.'
options = Options
def makeService(self, options):
if options['repo'] is None:
- raise usage.UsageError, 'Missing required argument'
+ raise usage.UsageError('Missing required argument')
backend = GitBackend(options['repo'])
return internet.UDPServer(int(options["port"]), TFTPProtocol(backend))