iwla

iwla Commit Details

Date:2015-01-11 18:06:18 (6 years 6 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:00ad08a201a2f45666e02af7edaa6a606cc3a4fb
Parents: 588b3179d572b6a76fd7f4a5b121b9a9d6bc814a
Message:Add try/catch in browsers display plugin in case of an icon doesn't exists)

Changes:
Mplugins/display/browsers.py (2 diffs)

File differences

plugins/display/browsers.py
8282
8383
8484
85
85
86
87
88
8689
8790
8891
8992
90
93
9194
9295
9396
......
111114
112115
113116
114
117
118
119
120
115121
116122
117123
118124
119
120
121
125
126
127
128
122129
123130
124131
new_list = self.max_browsers and browsers[:self.max_browsers] or browsers
for (browser, entrance) in new_list:
if browser != 'unknown':
icon = '<img src="/%s/browser/%s.png"/>' % (self.icon_path, awstats_data.browsers_icons[self.icon_names[browser]])
try:
icon = '<img src="/%s/browser/%s.png"/>' % (self.icon_path, awstats_data.browsers_icons[self.icon_names[browser]])
except:
icon = '<img src="/%s/browser/unknown.png"/>' % (self.icon_path)
else:
icon = '<img src="/%s/browser/unknown.png"/>' % (self.icon_path)
browser = 'Unknown'
table.appendRow([icon, browser, entrance])
total_browsers[1] += entrance
total_browsers[2] += entrance
if self.max_browsers:
others = 0
for (browser, entrance) in browsers[self.max_browsers:]:
table.setColsCSSClass(['', '', 'iwla_hit'])
for (browser, entrance) in browsers[:10]:
if browser != 'unknown':
icon = '<img src="/%s/browser/%s.png"/>' % (self.icon_path, awstats_data.browsers_icons[self.icon_names[browser]])
try:
icon = '<img src="/%s/browser/%s.png"/>' % (self.icon_path, awstats_data.browsers_icons[self.icon_names[browser]])
except:
icon = '<img src="/%s/browser/unknown.png"/>' % (self.icon_path)
else:
icon = '<img src="/%s/browser/unknown.png"/>' % (self.icon_path)
browser = 'Unknown'
table.appendRow([icon, browser, entrance])
total_browsers[1] -= entrance
if total_browsers[1]:
total_browsers[0] = self.iwla._(u'Others')
total_browsers[2] -= entrance
if total_browsers[2]:
total_browsers[0] = u''
total_browsers[1] = self.iwla._(u'Others')
table.appendRow(total_browsers)
table.setCellCSSClass(table.getNbRows()-1, 0, 'iwla_others')
index.appendBlock(table)

Archive Download the corresponding diff file

Branches

Tags