issue #106: get FileService working.

pull/193/head
David Wilson 6 years ago
parent 6aac37e157
commit 1a040cf5c0

@ -128,17 +128,21 @@ class FileService(mitogen.service.Service):
isinstance(args, tuple) and
len(args) == 2 and
args[0] in ('register', 'fetch') and
isinstance(args[1], str)
isinstance(args[1], basestring)
)
def dispatch(self, args, msg):
cmd, path = msg
cmd, path = args
return getattr(self, cmd)(path, msg)
def register(self, path, msg):
if not mitogen.core.has_parent_authority(msg):
raise mitogen.core.CallError(self.unprivileged_msg)
if path in self._paths:
return
LOG.info('%r: registering %r', self, path)
with open(path, 'rb') as fp:
self._paths[path] = zlib.compress(fp.read())

Loading…
Cancel
Save