damned-lies r1250 - in trunk: . common languages stats teams



Author: stephaner
Date: Mon Dec 29 16:59:24 2008
New Revision: 1250
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1250&view=rev

Log:
2008-12-29  StÃphane Raimbault  <stephane raimbault gmail com>

	* common/views.py:
	* languages/views.py:
	* stats/forms.py:
	* stats/models.py:
	* teams/models.py: has_key is deprecated since Python 2.5. 


Modified:
   trunk/ChangeLog
   trunk/common/views.py
   trunk/languages/views.py
   trunk/stats/forms.py
   trunk/stats/models.py
   trunk/teams/models.py

Modified: trunk/common/views.py
==============================================================================
--- trunk/common/views.py	(original)
+++ trunk/common/views.py	Mon Dec 29 16:59:24 2008
@@ -48,10 +48,10 @@
     referer = None
     openid_path = ''
     if request.method == 'POST':
-        if request.POST.has_key('logout') and request.POST['logout']:
+        if 'logout' in request.POST and request.POST['logout']:
             logout(request)
             messages.append(_("You have been logged out."))
-        elif request.POST.has_key('username'):
+        elif 'username' in request.POST:
             username = request.POST['username']
             password = request.POST['password']
             user = authenticate(username=username, password=password)

Modified: trunk/languages/views.py
==============================================================================
--- trunk/languages/views.py	(original)
+++ trunk/languages/views.py	Mon Dec 29 16:59:24 2008
@@ -86,7 +86,7 @@
         if catname != 'default':
             content += "<category id=\"%s\">" % catname
         # totals for category
-        if stats['doc']['categs'].has_key(catname):
+        if catname in stats['doc']['categs']:
             content += "<doctranslated>%s</doctranslated>" % stats['doc']['categs'][catname]['cattrans']
             content += "<docfuzzy>%s</docfuzzy>" % stats['doc']['categs'][catname]['catfuzzy']
             content += "<docuntranslated>%s</docuntranslated>" % stats['doc']['categs'][catname]['catuntrans']
@@ -97,7 +97,7 @@
         for modname, mod in categ['modules']:
             content += "<module id=\"%s\" branch=\"%s\">" % (modname, mod[1][1].branch.name)
             # find and iterate doc domains
-            if stats['doc']['categs'].has_key(catname) and stats['doc']['categs'][catname]['modules']:
+            if catname in stats['doc']['categs'] and stats['doc']['categs'][catname]['modules']:
                 for docmod in stats['doc']['categs'][catname]['modules']:
                     if docmod[0] == modname:
                         for doc_dom in docmod[1]:

Modified: trunk/stats/forms.py
==============================================================================
--- trunk/stats/forms.py	(original)
+++ trunk/stats/forms.py	Mon Dec 29 16:59:24 2008
@@ -5,7 +5,7 @@
 class ReleaseField(forms.ModelChoiceField):
     def __init__(self, *args, **kwargs):
         super(ReleaseField, self).__init__(*args, **kwargs)
-        if kwargs.has_key('initial'):
+        if 'initial' in kwargs:
             self.is_branch = True
 
 class ModuleBranchForm(forms.Form):

Modified: trunk/stats/models.py
==============================================================================
--- trunk/stats/models.py	(original)
+++ trunk/stats/models.py	Mon Dec 29 16:59:24 2008
@@ -667,7 +667,7 @@
         stats = {}
         total_docstrings, total_uistrings = self.total_strings()
         for row in cursor.fetchall():
-            if not stats.has_key(row[1]):
+            if row[1] not in stats:
                 # Initialize stats dict
                 stats[row[1]] = {
                     'lang_name': row[0], 'lang_locale': Language.slug_locale(row[1]),
@@ -726,7 +726,7 @@
             categdescr = stat.branch.category_set.get(release=self).name
             domname = _(stat.domain.description)
             modname = stat.branch.module.name
-            if not stats['categs'].has_key(categdescr):
+            if categdescr not in stats['categs']:
                 stats['categs'][categdescr] = {'cattrans':0, 'catfuzzy':0, 
                                                'catuntrans':0, 'modules':{}}
             # Try to get translated stat, else stick with POT stat
@@ -748,7 +748,7 @@
             stats['categs'][categdescr]['cattrans'] += stat.translated
             stats['categs'][categdescr]['catfuzzy'] += stat.fuzzy
             stats['categs'][categdescr]['catuntrans'] += stat.untranslated
-            if not stats['categs'][categdescr]['modules'].has_key(modname):
+            if modname not in stats['categs'][categdescr]['modules']:
                 # first element is a placeholder for a fake stat
                 stats['categs'][categdescr]['modules'][modname] = {' fake':None, domname:stat}
                 previous_domname = domname

Modified: trunk/teams/models.py
==============================================================================
--- trunk/teams/models.py	(original)
+++ trunk/teams/models.py	Mon Dec 29 16:59:24 2008
@@ -30,12 +30,12 @@
         roles = Role.objects.select_related("person").all()
         role_dict = {}
         for role in roles:
-            if not role_dict.has_key(role.team_id):
+            if role.team_id not in role_dict:
                 role_dict[role.team_id] = [role]
             else:
                 role_dict[role.team_id].append(role)
         for team in teams:
-            if role_dict.has_key(team.id):
+            if team.id in role_dict:
                 for role in role_dict[team.id]:
                     team.fill_role(role.role, role.person)
         return teams



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]