Bilal Akhtar avatar Bilal Akhtar committed 5479a3b

Change shorten_revid to shorten_id everywhere.
Also, fix the usage of length function arg in filter shorten_id

Comments (0)

Files changed (4)


 {% macro show_meta(rev) %}
     <div class="moin-diff-info moin-diff-info-rev-id">
         <span class="moin-diff-info-caption">Revision:</span>
-        <span class="moin-diff-info-value">{{ rev.meta['revid'] | shorten_revid }}</span>
+        <span class="moin-diff-info-value">{{ rev.meta['revid'] | shorten_id }}</span>
     <div class="moin-diff-info moin-diff-info-rev-author">
         <span class="moin-diff-info-caption">Editor:</span>


             {% for doc in history %}
                 <td class="moin-wordbreak">{{ }}</td>
-                <td class="moin-integer"><tt>{{ doc.revid|shorten_revid }}</tt></td>
+                <td class="moin-integer"><tt>{{ doc.revid | shorten_id }}</tt></td>
                 <td>{{ doc.mtime|datetimeformat }}</td>
                 <td class="moin-integer">{{ doc.size }}</td>


 {% block footer_meta %}
     {% if rev %}
     <p id="moin-pageinfo" lang="{{ theme_supp.ui_lang }}" dir="{{ theme_supp.ui_dir }}">
-        {% if cfg.show_interwiki %}{{ cfg.interwikiname }}:{% endif %}{{ item_name }} (rev {{rev.revid | shorten_revid}}),
+        {% if cfg.show_interwiki %}{{ cfg.interwikiname }}:{% endif %}{{ item_name }} (rev {{rev.revid | shorten_id}}),
         {{ _("modified") }} {{ rev.meta['mtime']|datetimeformat }}
         {{ _("by") }} {{ utils.editor_info(rev.meta) }}{% if rev.tags %},
         {{ _("tagged") }}


             name = u'{0}...{1}'.format(name[:half + left], name[-half:])
     return name
-def shorten_revid(name, length=7):
+def shorten_id(name, length=7):
-    Shorten revision IDs
+    Shorten IDs to specified length
-    Shorten long hex revids into just the first 7 characters. There's
-    no need to display the whole revids everywhere.
+    Shorten long IDs into just the first <length> characters. There's
+    no need to display the whole IDs everywhere.
     :param name: item name, unicode
-    :param length: Maximum length of the resulting revid, int
+    :param length: Maximum length of the resulting ID, int
     :rtype: unicode
-    :returns: truncated version
+    :returns: <name> truncated to <length> characters
-    return name[:7]
+    return name[:length]
     'application/pdf': 'pdf',
 def setup_jinja_env():
     app.jinja_env.filters['shorten_item_name'] = shorten_item_name
-    app.jinja_env.filters['shorten_revid'] = shorten_revid
+    app.jinja_env.filters['shorten_id'] = shorten_id
     app.jinja_env.filters['contenttype_to_class'] = contenttype_to_class
     # please note that these filters are installed by flask-babel:
     # datetimeformat, dateformat, timeformat, timedeltaformat
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.