+def setup(**kwargs):
+ """
+ Setup the phpbb backend. Takes the following keyword arguments:
+ dbhost -- The database server host
+ dbport -- The database server portname
+ dbname -- The database name
+ dbuser -- The username to log in
+ dbpass -- The password to log in
+ phpbb_prefix -- The table name prefix used for this phpbb installation
+ name -- The name to use for the auth backend
+ hint -- A hint to show in the login interface (HTML string)
+
+ This function can be called multiple times to create backends for
+ different phpbb installations
+
+ Returns a tuple (auth, groups) containing an (instantiated) auth backend
+ and a groups backend (constructor). These can be put directly into the
+ "auth" (as part of the list) and "groups" (directly) config directives.
+
+ e.g.,
+
+ class FarmConfig:
+ (phpbb_auth, phpbb_groups) = phpbb.setup(...)
+ auth = [phpbb_auth]
+ groups = phpbb_groups
+
+ (actual configuration parameters to setup() are omitted in this example)
+ """
+
+ # Create a "constructor" to create a phpbb_groups instance, while
+ # passing ourselves to it.
+ groups = lambda config, request: PhpbbGroupsBackend(request, **kwargs)
+ # Create an instantiated auth backend.
+ auth = PhpbbAuth(**kwargs)
+
+ return (auth, groups)
+