Commits

Thomas Waldmann  committed 9a7889c

fixed history view

  • Participants
  • Parent commits de6ece0
  • Branches storage-ng

Comments (0)

Files changed (6)

File MoinMoin/apps/frontend/views.py

     query = And([Term(WIKINAME, app.cfg.interwikiname), Term(NAME_EXACT, item_name), ])
     # TODO: due to how getPageContent and the template works, we need to use limit=None -
     # it would be better to use search_page (and an appropriate limit, if needed)
-    docs = flaskg.storage.search(query, all_revs=True, sortedby=[MTIME], reverse=True, limit=None)
+    revs = flaskg.storage.search(query, all_revs=True, sortedby=[MTIME], reverse=True, limit=None)
     # get rid of the content value to save potentially big amounts of memory:
-    history = [dict((k, v) for k, v in doc.iteritems() if k != CONTENT) for doc in docs]
+    history = [dict((k, v) for k, v in rev.meta.iteritems() if k != CONTENT) for rev in revs]
     history_page = util.getPageContent(history, offset, results_per_page)
     return render_template('history.html',
                            item_name=item_name, # XXX no item here

File MoinMoin/items/__init__.py

         if MTIME not in meta:
             meta[MTIME] = int(time.time())
 
+        if ADDRESS not in meta:
+            meta[ADDRESS] = u'0.0.0.0' # TODO
+
         meta[ACTION] = unicode(action)
 
         if not overwrite and REVID in meta:

File MoinMoin/templates/diff_text.html

     <div class="moin-diff-info moin-diff-info-rev-author">
         <span class="moin-diff-info-caption">Editor:</span>
         <span class="moin-diff-info-value">
-            {{ utils.editor_info(rev) }}
+            {{ utils.editor_info(rev.meta) }}
         </span>
     </div>
     <div class="moin-diff-info moin-diff-info-rev-size">
         <span class="moin-diff-info-caption">Size:</span>
-        <span class="moin-diff-info-value">{{ rev.size }}</span>
+        <span class="moin-diff-info-value">{{ rev.meta['size'] }}</span>
     </div>
     <div class="moin-diff-info moin-diff-info-rev-comment">
         <span class="moin-diff-info-caption">Comment:</span>
-        <span class="moin-diff-info-value">{{ rev.comment }}</span>
+        <span class="moin-diff-info-value">{{ rev.meta['comment'] }}</span>
     </div>
 {% endmacro %}
 

File MoinMoin/templates/show.html

     <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.revno}}),
         {{ _("modified") }} {{ rev.meta['mtime']|datetimeformat }}
-        {{ _("by") }} {{ utils.editor_info(rev) }}{% if rev.tags %},
+        {{ _("by") }} {{ utils.editor_info(rev.meta) }}{% if rev.tags %},
         {{ _("tagged") }}
         {% for tag in rev.tags -%}
         <a href="{{ url_for('frontend.tagged_items', tag=tag) }}">{{ tag }}</a>{% if not loop.last %}, {% endif %}

File MoinMoin/templates/utils.html

 {% endmacro %}
 
 
-{% macro editor_info(rev) %}
-  {%- set info = get_editor_info(rev) -%}
+{% macro editor_info(meta) %}
+  {%- set info = get_editor_info(meta) -%}
   {{ show_editor_info(info) }}
 {% endmacro %}
 

File MoinMoin/themes/__init__.py

         return url
 
 
-def get_editor_info(rev, external=False):
-    addr = rev.meta.get(ADDRESS)
-    hostname = rev.meta.get(HOSTNAME)
+def get_editor_info(meta, external=False):
+    addr = meta.get(ADDRESS)
+    hostname = meta.get(HOSTNAME)
     text = _('anonymous')  # link text
     title = ''  # link title
     css = 'editor'  # link/span css class
             title = '[%s]' % (addr, )
             css = 'editor ip'
 
-    userid = rev.meta.get(USERID)
+    userid = meta.get(USERID)
     if userid:
         u = user.User(userid)
         name = u.name
                             'cfg': app.cfg,
                             'item_name': 'handlers need to give it',
                             'url_for_item': url_for_item,
-                            'get_editor_info': lambda rev: get_editor_info(rev),
+                            'get_editor_info': lambda meta: get_editor_info(meta),
                             'utctimestamp': lambda dt: utctimestamp(dt),
                             'gen': make_generator(),
                             })