changeset 81:e02aceb91a9b

Make "full" a user filter and "none" an alias to "full"
author Franz Glasner <hg@dom66.de>
date Fri, 23 Feb 2018 12:58:56 +0100
parents f772a6cc2f67
children a622509323be
files extensions/kwarchive.py
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/kwarchive.py	Fri Feb 23 12:48:25 2018 +0100
+++ b/extensions/kwarchive.py	Fri Feb 23 12:58:56 2018 +0100
@@ -120,7 +120,8 @@
     :``user``:    the short representation of a user name or email address
     :``person``:  the name before an email address as per RFC 5322
     :``email``:   the email address
-    :``none``:    the complete user information w/o filtering
+    :``full``:    the complete user information w/o filtering
+    :``none``:    an alias for ``full``
 
     Returns 0 on success.
 
@@ -204,7 +205,8 @@
     :``user``:    the short representation of a user name or email address
     :``person``:  the name before an email address as per RFC 5322
     :``email``:   the email address
-    :``none``:    the complete user information w/o filtering
+    :``full``:    the complete user information w/o filtering
+    :``none``:    an alias for ``full``    
 
     Use --reST to output the keyword in a format suitable for including
     in reStructuredText (reST) documents by using it's substitution feature.
@@ -368,8 +370,15 @@
         keywords["Author"] = templatefilters.utf8(templatefilters.person(ctx.user()).replace(' ', '+'))
     elif user_filter == "email":
         keywords["Author"] = templatefilters.email(ctx.user())
-    elif user_filter == "none":
+    elif user_filter in ("full", "none",):
+        #
+        # "none" is retained for compatibility reasons and now an
+        # alias for "full".
+        # But make it **one** word because that is meant in the RCS spec.
+        #
         keywords["Author"] = templatefilters.utf8(ctx.user().replace(' ', '+'))
+    else:
+        raise error.Abort(_("unknown user filter"))
 
     return keywords
 
@@ -386,6 +395,7 @@
 
 def get_checked_user_filter(opts):
     uf = opts.get("user_filter")
-    if not uf in ("person", "user", "email", "none"):
+    # "none" is retained for compatibility reasons and now an alias for "full"
+    if not uf in ("person", "user", "email", "full", "none"):
         raise error.Abort(_("user filter must be any of `user', `person' or `email'"))
     return uf