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.
This has been fixed in the current patch revision for 1.5.6. -- DeronMeranda 2006-11-13 16:36:24
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
Yes, it appears as if there was a bug in how the @SIG@ placeholder was expanded in MoinMoin/user.py (actually in the method user.signature()). I've uploaded a new patch file which corrects that bug in addition to the new functionality I've added. -- -- DeronMeranda 2006-05-11 15:19:12
But it doesn't (and can't) resolve the case where the user types his/her name in directly (which I don't believe is uncommon - I certainly do it all the time). I'm not really arguing that this should be fixed (as I don't believe it can be), rather I'm arguing that it's a flaw in the concept, which might make it less useful than it seems at first. Of course, as the setting is optional, this isn't a showstopper, it just means that it should be off by default (actually, I suppose it's no worse than user_homewiki, which I have never used myself) -- PaulMoore
If you have users conditioned to typing their names in the WikiName format and expect those to be linked, then user namespaces is probably not for you. The same restriction also applies if you're using the already-existing feature of wiki farms---you can't use simple wiki names there either. Although with this feature you can still have both by picking a namespace like "User" instead of "User/". By simply accepting the default config in this patch you will get the same namespace-less behavior. However if you really want namespaces moreso than the convenience of having simple wiki names, then this patch works quite well. All the links to user homepages just work, whether in the top navigation bar, the history/info page, the recent changes list, and now the @SIG@ expansion. Also, by having namespaces it makes it easier to distinguish homepages with regular expressions (as on you "subscribed pages" list, or searches). -- DeronMeranda 2006-05-12 14:28:18
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