Allow user homepages to be created under a namespace

Currently (1.5.6), the homepages for users are stored with the same name as the username, such as JohnDoe. It would be nice if the homepages could optionally be stored under a namespace or common prefix, such as User/JohnDoe instead. This would help prevent polution of the top-level wiki space with user pages.

This would complement the user_homewiki configuration which allows homedirs to be stored on other wikis. Only this would allow a prefix within that wiki to be specified, even if it is Self (the default).

This request could be considered part of the much larger feature request FeatureRequests/NameSpaces.

Patch

Patch against 1.5.6: moin156-usernamespace2.patch (see the page attachments for older patch revisions)

This patch adds a new configuration option user_namespace, which defaults to an empty string (for identical backwards behavior).

If the configuration is set to some other string value, such as "User/", then that prefix will be prepended to the username to compute the homepage name. This works regardless of the setting of the user_homewiki option.

Places where you normally see usernames, such as the page info (history), will continue to show just the username portion, but will link to the correct homepage (with the prefix).

The patch also updates the MyPages special action to match the namespace behavior. Documentation on this configuration option is not yet written or included in the attached patch.

Note that this patch should only be applied to new installations, unless you want to do a lot of work renaming the existing homepages and links to them.

Discussion

I (an anonymous user _) have applied this patch [1.5.3 version], and wish to note that even after applying it, going to a username's page results in the MissingHomePage template being applied, and it is not applied for the new userspace homepage. Modifying line 1391 [of file !MoinMoin/Page.py] from

if request.user.valid and request.user.name == self.page_name:

to:

if request.user.valid and request.cfg.user_namespace+request.user.name == self.page_name:

fixes this possible oversight. I say "possible" because it might be due to the fact that my "user_namespace" setting is just '~' instead of a real SubPage.

PaulMoore: One problem is that a user's name is no longer a link to their home page. (Example at the start of this comment, and at the end, where I used @SIG@...) -- PaulMoore 2006-05-11 12:36:55


I think you could have a similar effect without patch by using:

intermap.txt:
MyWiki http://server/
User http://server/User/

wikiconfig.py:
    user_homewiki = 'User'

Of course this doesn't really separate your users (like when using a different wiki), but it should put all under page User.

-- ThomasWaldmann 2008-05-18 09:10:13


CategoryFeatureRequest CategoryFeaturePatched

MoinMoin: FeatureRequests/UserNamespace (last edited 2008-05-18 09:42:41 by ThomasWaldmann)