Example #1
0
 def makeService(self, options):
     """Construct a TCPServer:
     """
     root = static.File(ROOT)
     for name, path, pwfile, users in CHILDREN:
         pwd = Password(pwfile)
         try:
             pwd.load()
         except (IllegalFormat, IOError), e:
             # print >>sys.stderr, e
             sys.exit(2)
         pwdic = {}
         for user in users:
             try:
                 password = pwd.pwd[user]
                 pwdic[user] = password
             except KeyError:
                 pass
         parse_result = urlparse.urlparse(path)
         if parse_result.scheme == "s3":
             bucket = parse_result.netloc
             path = parse_result.path
             child = BucketResource(bucket, path, pwdic)
         else:
             child = WebDAV(path, pwdic=pwdic, ignoredExts=("",))
         # print "root.putChild(%s, %s)"%(name, child)
         root.putChild(name, child)
Example #2
0
    # (childname, path, passwordfile, [allow_users])
    ("yasusii", "/home/akadav/yasusii", "/home/akadav/users", ["yasusii"]),
    ("murako", "/home/akadav/murako", "/home/akadav/users", ["murako"]),
    ("ahi", "/home/akadav/ahi", "/home/akadav/users", ["ahi"]),
    ("share", "/home/akadav/share", "/home/akadav/users",
     ["yasusii", "murako", "ahi"])]

# End of Server Configuration

# Launch server application.

application = service.Application("akadav", **APP_ARGS)
serviceCollection = service.IServiceCollection(application)
root = static.File(ROOT)
for name, path, pwfile, users in CHILDREN:
    pwd = Password(pwfile)
    try:
        pwd.load()
    except (IllegalFormat, IOError), e:
        print >>sys.stderr, e
        sys.exit(2)
    pwdic = {}
    for user in users:
        try:
            password = pwd.pwd[user]
            pwdic[user] = password
        except KeyError:
            pass
    child = WebDAV(path, pwdic=pwdic)
    root.putChild(name, child)
site = Site(root, **SITE_ARGS)