예제 #1
0
 def test_passwordDatabase(self):
     """
     If L{UserDirectory} is instantiated with no arguments, it uses the
     L{pwd} module as its password database.
     """
     directory = distrib.UserDirectory()
     self.assertIdentical(directory._pwd, pwd)
예제 #2
0
 def opt_user(self):
     """Makes a server with ~/public_html and ~/.twistd-web-pb support for
     users.
     """
     self['root'] = distrib.UserDirectory()
예제 #3
0
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
An example showing how to use a distributed web server's user directory support.

With this, you can have an instant "community web site",
letting your shell users publish data in secure ways.

Just put this script anywhere, and /path/to/this/script/<user>/ will publish a
user's ~/public_html, and a .../<user>.twistd/ will attempt to contact a user's
personal web server.

For example, if you put this at /var/www/users.rpy and run a server like:
    $ twistd -n web --allow-ignore-ext --path /var/www

Then http://example.com/users/<name>/ and http://example.com/users/<name>.twistd
will work similarly to how they work on twistedmatrix.com.
"""

from twisted.web import distrib

resource = distrib.UserDirectory()
registry.setComponent(distrib.UserDirectory, resource)
예제 #4
0
 def setUp(self):
     self.alice = ('alice', 'x', 123, 456, 'Alice,,,', self.mktemp(), '/bin/sh')
     self.bob = ('bob', 'x', 234, 567, 'Bob,,,', self.mktemp(), '/bin/sh')
     self.database = _PasswordDatabase([self.alice, self.bob])
     self.directory = distrib.UserDirectory(self.database)
예제 #5
0
 def setUp(self):
     self.alice = ("alice", "x", 123, 456, "Alice,,,", self.mktemp(),
                   "/bin/sh")
     self.bob = ("bob", "x", 234, 567, "Bob,,,", self.mktemp(), "/bin/sh")
     self.database = _PasswordDatabase([self.alice, self.bob])
     self.directory = distrib.UserDirectory(self.database)