changeset 2068:f664d3b57fa4 beta

p2.5 fixes
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 29 Feb 2012 02:38:14 +0200
parents de372c3a329e
children 003c504da933
files docs/changelog.rst rhodecode/controllers/changeset.py rhodecode/controllers/summary.py rhodecode/lib/compat.py rhodecode/templates/admin/repos/repos.html rhodecode/templates/index_base.html
diffstat 6 files changed, 27 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/docs/changelog.rst	Tue Feb 28 20:56:32 2012 +0200
+++ b/docs/changelog.rst	Wed Feb 29 02:38:14 2012 +0200
@@ -17,6 +17,8 @@
 fixes
 +++++
 
+- fixed some python2.5 compatibility issues 
+
 1.3.2 (**2012-02-28**)
 ----------------------
 
--- a/rhodecode/controllers/changeset.py	Tue Feb 28 20:56:32 2012 +0200
+++ b/rhodecode/controllers/changeset.py	Wed Feb 29 02:38:14 2012 +0200
@@ -53,7 +53,7 @@
 
 def anchor_url(revision, path):
     fid = h.FID(revision, path)
-    return h.url.current(anchor=fid, **request.GET)
+    return h.url.current(anchor=fid, **dict(request.GET))
 
 
 def get_ignore_ws(fid, GET):
--- a/rhodecode/controllers/summary.py	Tue Feb 28 20:56:32 2012 +0200
+++ b/rhodecode/controllers/summary.py	Wed Feb 29 02:38:14 2012 +0200
@@ -28,8 +28,8 @@
 import logging
 from time import mktime
 from datetime import timedelta, date
-from itertools import product
 from urlparse import urlparse
+from rhodecode.lib.compat import product
 
 from rhodecode.lib.vcs.exceptions import ChangesetError, EmptyRepositoryError, \
     NodeDoesNotExistError
--- a/rhodecode/lib/compat.py	Tue Feb 28 20:56:32 2012 +0200
+++ b/rhodecode/lib/compat.py	Wed Feb 29 02:38:14 2012 +0200
@@ -379,3 +379,21 @@
 
 else:
     kill = os.kill
+
+
+#==============================================================================
+# itertools.product
+#==============================================================================
+
+try:
+    from itertools import product
+except ImportError:
+    def product(*args, **kwds):
+        # product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy
+        # product(range(2), repeat=3) --> 000 001 010 011 100 101 110 111
+        pools = map(tuple, args) * kwds.get('repeat', 1)
+        result = [[]]
+        for pool in pools:
+            result = [x + [y] for x in result for y in pool]
+        for prod in result:
+            yield tuple(prod)
--- a/rhodecode/templates/admin/repos/repos.html	Tue Feb 28 20:56:32 2012 +0200
+++ b/rhodecode/templates/admin/repos/repos.html	Wed Feb 29 02:38:14 2012 +0200
@@ -42,8 +42,8 @@
           </tr>
          </thead>
 
-          %for cnt,repo in enumerate(c.repos_list,1):
-          <tr class="parity${cnt%2}">
+          %for cnt,repo in enumerate(c.repos_list):
+          <tr class="parity${(cnt+1)%2}">
               <td class="quick_repo_menu">
                 ${dt.quick_menu(repo['name'])}
               </td>
--- a/rhodecode/templates/index_base.html	Tue Feb 28 20:56:32 2012 +0200
+++ b/rhodecode/templates/index_base.html	Wed Feb 29 02:38:14 2012 +0200
@@ -69,8 +69,8 @@
                 </tr>
             </thead>
             <tbody>
-            %for cnt,repo in enumerate(c.repos_list,1):
-                <tr class="parity${cnt%2}">
+            %for cnt,repo in enumerate(c.repos_list):
+                <tr class="parity${(cnt+1)%2}">
                     ##QUICK MENU
                     <td class="quick_repo_menu">
                       ${dt.quick_menu(repo['name'])}
@@ -115,7 +115,7 @@
         </div>
     </div>
     <script>
-      YUD.get('repo_count').innerHTML = ${cnt};
+      YUD.get('repo_count').innerHTML = ${cnt+1};
       var func = function(node){
           return node.parentNode.parentNode.parentNode.parentNode;
       }