Add bytesToStr()
Automatically convert list into strings in appendRow() Add package information
This commit is contained in:
		
							
								
								
									
										1
									
								
								plugins/display/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								plugins/display/__init__.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| # | ||||
| @@ -18,15 +18,20 @@ def load(): | ||||
| def hook(iwla): | ||||
|     stats = iwla.getMonthStats() | ||||
|  | ||||
|     if not 'top_visitors' in stats.keys(): | ||||
|     top_visitors = stats.get('top_visitors', None) | ||||
|     if not top_visitors: | ||||
|         print 'Top visitors post analysis plugin not installed' | ||||
|         return | ||||
|  | ||||
|     index = iwla.getDisplayIndex() | ||||
|     table = DisplayHTMLBlockTable('Top visitors', ['Host', 'Pages', 'Hits', 'Bandwidth', 'Last seen']) | ||||
|     for super_hit in stats['top_visitors']: | ||||
|         row = [super_hit['remote_addr'], super_hit['viewed_pages'], super_hit['viewed_hits'], super_hit['bandwidth'], 0] | ||||
|         row = map(lambda(v): str(v), row) | ||||
|         row[4] = time.asctime(super_hit['last_access']) | ||||
|     for super_hit in top_visitors: | ||||
|         row = [ | ||||
|             super_hit['remote_addr'], | ||||
|             super_hit['viewed_pages'], | ||||
|             super_hit['viewed_hits'], | ||||
|             bytesToStr(super_hit['bandwidth']), | ||||
|             time.asctime(super_hit['last_access']) | ||||
|             ] | ||||
|         table.appendRow(row) | ||||
|     index.appendBlock(table) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user