changeset 399:fdd1b2dec689

Improved index --for ... --action show output, syntax change in css class name
author Michael Mayorov <marchael@kb.csu.ru>
date Sat, 06 Aug 2011 03:11:22 +0000
parents a9b78e0231c6
children ea001bcb5f90
files MoinMoin/script/maint/index.py MoinMoin/templates/search_results.html MoinMoin/themes/modernized/static/css/common.css
diffstat 3 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/maint/index.py	Fri Aug 05 01:14:40 2011 +0000
+++ b/MoinMoin/script/maint/index.py	Sat Aug 06 03:11:22 2011 +0000
@@ -161,21 +161,31 @@
             """
             Print documents in given index to stdout
             """
+            from whoosh.index import EmptyIndexError
+
             for indexname, schema in indexnames_schemas:
                 try:
                     if "all" in indexname:
                         all_index = open_dir(app.cfg.index_dir, indexname="all_revisions_index")
-                        print "Revisions in all_revisions_index:"
+                        print "*** Revisions in all_revisions_index:"
                         with all_index.searcher() as searcher:
                             for rev in searcher.all_stored_fields():
-                                print repr(rev)
+                                name = rev.pop("name", u"")
+                                content = rev.pop("content", u"")
+                                for field, value in [("name", name), ] + sorted(rev.items()) + [("content", content), ]:
+                                    print "%s: %s" % (field, repr(value)[:70])
+                                print "\n"
                         all_index.close()
                     if "latest" in indexname:
                         latest_index = open_dir(app.cfg.index_dir, indexname="latest_revisions_index")
-                        print "Revisions in latest_revision_index:"
+                        print "*** Revisions in latest_revision_index:"
                         with latest_index.searcher() as searcher:
                             for rev in searcher.all_stored_fields():
-                                print repr(rev)
+                                name = rev.pop("name", u"")
+                                content = rev.pop("content", u"")
+                                for field, value in [("name", name), ] + sorted(rev.items()) + [("content", content), ]:
+                                    print "%s: %s" % (field, repr(value)[:70])
+                                print "\n"
                         latest_index.close()
                 except (IOError, OSError, EmptyIndexError) as err:
                     raise FatalError("%s [Can not open %s index" % str(err), indexname)
--- a/MoinMoin/templates/search_results.html	Fri Aug 05 01:14:40 2011 +0000
+++ b/MoinMoin/templates/search_results.html	Sat Aug 06 03:11:22 2011 +0000
@@ -38,7 +38,7 @@
             </tr>
             <tr>
                 <td>
-                <p class="info foundedtext">{{ result.highlights('content')|safe }}</p>  
+                <p class="info foundtext">{{ result.highlights('content')|safe }}</p>
                 </td>
             </tr>
             {% endfor %}
--- a/MoinMoin/themes/modernized/static/css/common.css	Fri Aug 05 01:14:40 2011 +0000
+++ b/MoinMoin/themes/modernized/static/css/common.css	Sat Aug 06 03:11:22 2011 +0000
@@ -178,7 +178,7 @@
 .searchresults td { border-width: 0; }
 .searchresults p.info { margin-left: 2%; }
 .searchresults .searchhitinfobar { color: #008000; margin-left: 15px; margin-top: 0; }
-.searchresults .foundedtext { margin-left: 15px; margin-top: 0; }
+.searchresults .foundtext { margin-left: 15px; margin-top: 0; }
 p.searchstats { font-size: 0.8em; text-align: right; width: 100%; background-color: #E6EAF0;
             border-top: 1px solid #9088DC; padding: 2px; }
 p.searchhint { background-color: #E6EAF0; border: 1px solid #9088DC; padding: 2px; }