]> git.phdru.name Git - phdru.name/cgi-bin/blog-ru/search-tags.git/blobdiff - search-tags.py
HTML-escape expression in the output (to quote &)
[phdru.name/cgi-bin/blog-ru/search-tags.git] / search-tags.py
index 8e047e1b400fb46fdd79bb1c0f5652f249091433..e40f05c0500e5104d88e0948da57a7196ba85dbc 100755 (executable)
@@ -3,7 +3,7 @@
 """Search tags CGI"""
 
 __author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2014 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2014-2016 PhiloSoft Design"
 __license__ = "GNU GPL"
 
 import cgi, sys
@@ -38,5 +38,24 @@ else:
         status = "404 Tag not found"
         title = "Ошибка!"
         body = "Тег %s не существует!" % tag
+    else: # Process tree
+        from tags import find_tags
+        posts = find_tags(tree)
+        status = None
+        title = "Записи, найденные для выражения " + cgi.escape(q)
+        if posts:
+            _posts = ["""\
+<p class="head">
+<ul>
+"""]
+            for year, month, day, suburl, _title in posts:
+                _posts.append('<li>%s-%s-%s <a href="../../../../Russian/blog/%s">%s</a></li>\n' % (year, month, day, suburl, _title))
+            _posts .append("""\
+</ul>
+</p>
+""")
+            body = ''.join(_posts)
+        else:
+            body = "Не найдено ни одной записи."
 
 response(title, body, status)