Commits

Ashutosh Singla committed a52e0af

Fixes the sub-items related issues, 351 -Nesting sub-items created problem (TypeError: can only concatenate list (not unicode) to list), 335 - Subitems links were not functioning properly and 320- links in the index view were having the same problem. The fix required adding a extra filed to IndexEntry (line 235,MoinMoin/items/__init__.py), which earlier stored only name and meta, i.e had no provision to get fullname of the current item, so i added a field fullname to both IndexEntry and MixedIndexEntry and adjusted the code accordingly

Comments (0)

Files changed (4)

MoinMoin/items/__init__.py

             queries.append(Prefix(CONTENTTYPE, ct_unicode + u';'))
     return Or(queries)
 
-IndexEntry = namedtuple('IndexEntry', 'relname meta')
+IndexEntry = namedtuple('IndexEntry', 'relname fullname meta')
 
-MixedIndexEntry = namedtuple('MixedIndexEntry', 'relname meta hassubitems')
+MixedIndexEntry = namedtuple('MixedIndexEntry', 'relname fullname meta hassubitems')
 
 
 class NameNotUniqueError(ValueError):
                             added_dir_relnames.add(direct_relname)
                             direct_fullname = prefix + direct_relname
                             direct_rev = get_storage_revision(direct_fullname)
-                            dirs.append(IndexEntry(direct_relname, direct_rev.meta))
+                            dirs.append(IndexEntry(direct_relname, direct_fullname, direct_rev.meta))
                     else:
-                        files.append(IndexEntry(relname, rev.meta))
+                        files.append(IndexEntry(relname, fullname, rev.meta))
 
         return dirs, files
 

MoinMoin/items/_tests/test_Item.py

     """
     Build a list of IndexEntry by hand, useful as a test helper.
     """
-    return [(IndexEntry(relname, Item.create('/'.join((basename, relname))).meta))
+    return [(IndexEntry(relname, '/'.join((basename, relname)), Item.create('/'.join((basename, relname))).meta))
             for relname in relnames]
 
 
 
     :spec is a list of (relname, hassubitem) tuples.
     """
-    return [(MixedIndexEntry(relname, Item.create('/'.join((basename, relname))).meta, hassubitem))
+    return [(MixedIndexEntry(relname, '/'.join((basename, relname)), Item.create('/'.join((basename, relname))).meta, hassubitem))
             for relname, hassubitem in spec]
 
 

MoinMoin/templates/index.html

 
 {% macro render_dir_entry(e) %}
     <div>
-        <a href="{{ url_for('.index', item_name=e.meta['name']) }}"
+        <a href="{{ url_for('.index', item_name=e.fullname) }}"
            name="{{ entry_anchor('dir', e) }}"
            {# TODO .moin-dir-item class is not styled yet #}
            class="moin-dir-item"
     <div>
         <span class="moin-select-item">&nbsp;</span>
         {% set mimetype = "application/x.moin.download" %}
-        <a href="{{ url_for('.download_item', item_name=e.meta['name'], mimetype=mimetype) }}" class="moin-download-link">
+        <a href="{{ url_for('.download_item', item_name=e.fullname, mimetype=mimetype) }}" class="moin-download-link">
         </a>
-        <a href="{{ url_for('.show_item', item_name=e.meta['name']) }}"
+        <a href="{{ url_for('.show_item', item_name=e.fullname) }}"
            name="{{ entry_anchor('file', e) }}"
            {# TODO .moin-itemtype-* classes are not styled yet #}
            class="{{ e.meta['contenttype']|contenttype_to_class }} moin-itemtype-{{ e.meta['itemtype'] }} moin-item"

MoinMoin/templates/utils.html

                 {# call our parent's caller with all the data we have if they exist, used to implement
                     transclude/link actions in the modify view #}
                 {% if parentcaller %}
-                    {{ parentcaller(e.meta['name'], e.relname, e.meta['contenttype'], e.hassubitems) }}
+                    {{ parentcaller(e.fullname, e.relname, e.meta['contenttype'], e.hassubitems) }}
                 {% endif %}
-                <a href="{{ url_for('frontend.show_item', item_name=e.meta['name']) }}"
+                <a href="{{ url_for('frontend.show_item', item_name=e.fullname) }}"
                     title="{{ e.relname }}" class="subitem-link"
                     {% if newtab %}target="_blank"{% endif %}>{{ e.relname }}</a>
                 {% if e.hassubitems %}
                     <button class="expander" title="{{ _('Expand Subitem') }}"
                         onclick="toggleSubtree(this)"></button>
-                    {{ _render_subitem_navigation_tree(theme_supp.subitem_index(e.meta['name']), newtab, parentcaller) }}
+                    {{ _render_subitem_navigation_tree(theme_supp.subitem_index(e.fullname), newtab, parentcaller) }}
                 {% endif %}
             </li>
         {% endfor %}
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 ProjectModifiedEvent.java.
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.