~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to debian/patches/00842_fix_stats_useragents_indexerror.patch

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mfrom: (0.9.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080622211713-fpo2zrq3s5dfecxg
Tags: 1.7.0-3
Simplify /etc/moin/wikilist format: "USER URL" (drop unneeded middle
CONFIG_DIR that was wrongly advertised as DATA_DIR).  Make
moin-mass-migrate handle both formats and warn about deprecation of
the old one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
# HG changeset patch
3
 
# User Thomas Waldmann <tw AT waldmann-edv DOT de>
4
 
# Date 1183235130 -7200
5
 
# Node ID 286ed231b5e4144578a76eb6cac5375e6e2d6d11
6
 
# Parent 82684ab6afcd1b8429b94a6afe9dace34d0f0a7a
7
 
stats: useragents: fix IndexError
8
 
 
9
 
--- a/MoinMoin/stats/useragents.py      Sat Jun 30 18:49:39 2007 +0200
10
 
+++ b/MoinMoin/stats/useragents.py      Sat Jun 30 22:25:30 2007 +0200
11
 
@@ -70,12 +70,16 @@ def get_data(request):
12
 
             if ua:
13
 
                 pos = ua.find(" (compatible; ")
14
 
                 if pos >= 0:
15
 
-                    ua = ua[pos:].split(';')[1].strip()
16
 
+                    ua = ua[pos:].split(';')[1]
17
 
                 else:
18
 
-                    ua = ua.split()[0]
19
 
-                #ua = ua.replace(';', '\n')
20
 
-                data[ua] = data.get(ua, 0) + 1
21
 
-    
22
 
+                    try:
23
 
+                        ua = ua.split()[0]
24
 
+                    except IndexError:
25
 
+                        ua = ''
26
 
+                ua = ua.strip()
27
 
+                if ua:
28
 
+                    data[ua] = data.get(ua, 0) + 1
29
 
+
30
 
         # write results to cache
31
 
         cache.update("(%r, %r)" % (new_date, data))
32
 
             
33