Fix unicode problems
Add generateHTMLLink()
This commit is contained in:
		| @@ -49,12 +49,12 @@ class IWLADisplayReferers(IPlugin): | ||||
|  | ||||
|         table.appendRow(['<b>External URL</b>', '', '']) | ||||
|         for r,_ in top_referers: | ||||
|             row = [r, referers[r]['pages'], referers[r]['hits']] | ||||
|             row = [generateHTMLLink(r), referers[r]['pages'], referers[r]['hits']] | ||||
|             table.appendRow(row) | ||||
|  | ||||
|         table.appendRow(['<b>External URL (robot)</b>', '', '']) | ||||
|         for r,_ in top_robots_referers: | ||||
|             row = [r, robots_referers[r]['pages'], robots_referers[r]['hits']] | ||||
|             row = [generateHTMLLink(r), robots_referers[r]['pages'], robots_referers[r]['hits']] | ||||
|             table.appendRow(row) | ||||
|  | ||||
|         page.appendBlock(table) | ||||
| @@ -77,12 +77,12 @@ class IWLADisplayReferers(IPlugin): | ||||
|  | ||||
|         table.appendRow(['<b>External URL</b>', '', '']) | ||||
|         for r,_ in top_referers[:10]: | ||||
|             row = [r, referers[r]['pages'], referers[r]['hits']] | ||||
|             row = [generateHTMLLink(r), referers[r]['pages'], referers[r]['hits']] | ||||
|             table.appendRow(row) | ||||
|  | ||||
|         table.appendRow(['<b>External URL (robot)</b>', '', '']) | ||||
|         for r,_ in top_robots_referers[:10]: | ||||
|             row = [r, robots_referers[r]['pages'], robots_referers[r]['hits']] | ||||
|             row = [generateHTMLLink(r), robots_referers[r]['pages'], robots_referers[r]['hits']] | ||||
|             table.appendRow(row) | ||||
|  | ||||
|         index.appendBlock(table) | ||||
| @@ -99,7 +99,7 @@ class IWLADisplayReferers(IPlugin): | ||||
|         for phrase in top_key_phrases: | ||||
|             table.appendRow([phrase[0], phrase[1]]) | ||||
|         page.appendBlock(table) | ||||
|                          | ||||
|  | ||||
|         display.addPage(page) | ||||
|  | ||||
|         link = '<a href=\'%s\'>All key phrases</a>' % (filename) | ||||
|   | ||||
| @@ -23,7 +23,7 @@ class IWLADisplayTopDownloads(IPlugin): | ||||
|         table = DisplayHTMLBlockTable('All Downloads', ['URI', 'Hit']) | ||||
|         table.setColsCSSClass(['', 'iwla_hit']) | ||||
|         for (uri, entrance) in top_downloads: | ||||
|             table.appendRow([uri, entrance]) | ||||
|             table.appendRow([generateHTMLLink(uri), entrance]) | ||||
|         page.appendBlock(table) | ||||
|                          | ||||
|         self.iwla.getDisplay().addPage(page) | ||||
| @@ -37,5 +37,5 @@ class IWLADisplayTopDownloads(IPlugin): | ||||
|         table = DisplayHTMLBlockTable(title, ['URI', 'Hits']) | ||||
|         table.setColsCSSClass(['', 'iwla_hit']) | ||||
|         for (uri, entrance) in top_downloads[:10]: | ||||
|             table.appendRow([uri, entrance]) | ||||
|             table.appendRow([generateHTMLLink(uri), entrance]) | ||||
|         index.appendBlock(table) | ||||
|   | ||||
| @@ -23,7 +23,7 @@ class IWLADisplayTopHits(IPlugin): | ||||
|         table = DisplayHTMLBlockTable('All Hits', ['URI', 'Entrance'])         | ||||
|         table.setColsCSSClass(['', 'iwla_hit']) | ||||
|         for (uri, entrance) in top_hits: | ||||
|             table.appendRow([uri, entrance]) | ||||
|             table.appendRow([generateHTMLLink(uri), entrance]) | ||||
|         page.appendBlock(table) | ||||
|                          | ||||
|         self.iwla.getDisplay().addPage(page) | ||||
| @@ -37,5 +37,5 @@ class IWLADisplayTopHits(IPlugin): | ||||
|         table = DisplayHTMLBlockTable(title, ['URI', 'Entrance'])         | ||||
|         table.setColsCSSClass(['', 'iwla_hit']) | ||||
|         for (uri, entrance) in top_hits[:10]: | ||||
|             table.appendRow([uri, entrance]) | ||||
|             table.appendRow([generateHTMLLink(uri), entrance]) | ||||
|         index.appendBlock(table) | ||||
|   | ||||
| @@ -23,7 +23,7 @@ class IWLADisplayTopPages(IPlugin): | ||||
|         table = DisplayHTMLBlockTable('All Pages', ['URI', 'Entrance']) | ||||
|         table.setColsCSSClass(['', 'iwla_hit']) | ||||
|         for (uri, entrance) in top_pages: | ||||
|             table.appendRow([uri, entrance]) | ||||
|             table.appendRow([generateHTMLLink(uri), entrance]) | ||||
|         page.appendBlock(table) | ||||
|                          | ||||
|         self.iwla.getDisplay().addPage(page) | ||||
| @@ -37,5 +37,5 @@ class IWLADisplayTopPages(IPlugin): | ||||
|         table = DisplayHTMLBlockTable(title, ['URI', 'Entrance']) | ||||
|         table.setColsCSSClass(['', 'iwla_hit']) | ||||
|         for (uri, entrance) in top_pages[:10]: | ||||
|             table.appendRow([uri, entrance]) | ||||
|             table.appendRow([generateHTMLLink(uri), entrance]) | ||||
|         index.appendBlock(table) | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| import re | ||||
| import xml.sax.saxutils as saxutils | ||||
| import urllib | ||||
|  | ||||
| from iwla import IWLA | ||||
| from iplugin import IPlugin | ||||
| @@ -57,8 +57,7 @@ class IWLAPostAnalysisReferers(IPlugin): | ||||
|             groups = key_phrase_re.match(p) | ||||
|             if groups: | ||||
|                 key_phrase = groups.groupdict()['key_phrase'] | ||||
|                 key_phrase = key_phrase.replace('+', ' ').lower() | ||||
|                 key_phrase = saxutils.unescape(key_phrase) | ||||
|                 key_phrase = urllib.unquote_plus(key_phrase).decode('utf8') | ||||
|                 if not key_phrase in key_phrases.keys(): | ||||
|                     key_phrases[key_phrase] = 1 | ||||
|                 else: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user