Stefan Zimmermann avatar Stefan Zimmermann committed 93596f0

applied necessary changes from 2to3 script to admin_tools/ (sometimes with little modification)

Comments (0)

Files changed (11)

admin_tools/dashboard/dashboards.py

         """
         Internal method used to distinguish different dashboards in js code.
         """
-        return '%s-dashboard' % slugify(unicode(self.app_title))
+        return '%s-dashboard' % slugify(str(self.app_title))
 
 
 class DefaultIndexDashboard(Dashboard):

admin_tools/dashboard/management/commands/customdashboard.py

             raise CommandError('file "%s" already exists' % dst)
         context['file'] = os.path.basename(dst).split('.')[0]
         open(dst, 'w').write(render_to_string(tpl, context))
-        print '"%s" written.' % os.path.join(dst)
+        print('"%s" written.' % os.path.join(dst))
 

admin_tools/dashboard/modules.py

                 model_dict['add_url'] = self._get_admin_add_url(model, context)
             apps[app_label]['models'].append(model_dict)
 
-        apps_sorted = apps.keys()
-        apps_sorted.sort()
+        apps_sorted = sorted(apps.keys())
         for app in apps_sorted:
             # sort model list alphabetically
             apps[app]['models'].sort(lambda x, y: cmp(x['title'], y['title']))

admin_tools/dashboard/utils.py

     raise ValueError('Invalid dashboard location: "%s"' % location)
 
 def _get_dashboard_cls(dashboard_cls, context):
-    if type(dashboard_cls) is types.DictType:
+    if type(dashboard_cls) is dict:
         curr_url = context.get('request').META['PATH_INFO']
         for key in dashboard_cls:
             admin_site_mod, admin_site_inst = key.rsplit('.', 1)

admin_tools/dashboard/views.py

 except ImportError:
     from django.contrib.csrf.middleware import csrf_exempt
 
-from forms import DashboardPreferencesForm
-from models import DashboardPreferences
+from .forms import DashboardPreferencesForm
+from .models import DashboardPreferences
 
 
 @login_required

admin_tools/menu/forms.py

-import urllib
+try: from urllib import parse as urllib
+except ImportError: import urllib
 
 from django import forms
 

admin_tools/menu/items.py

                 'url': self._get_admin_change_url(model, context)
             })
 
-        apps_sorted = apps.keys()
-        apps_sorted.sort()
+        apps_sorted = sorted(apps.keys())
         for app in apps_sorted:
             app_dict = apps[app]
             item = MenuItem(title=app_dict['title'], url=app_dict['url'])

admin_tools/menu/management/commands/custommenu.py

             'project': project_name,
             'file': os.path.basename(dst).split('.')[0]
         }))
-        print '"%s" written.' % os.path.join(dst)
+        print('"%s" written.' % os.path.join(dst))
 

admin_tools/menu/views.py

 except ImportError:
     from django.contrib.csrf.middleware import csrf_exempt
 
-from forms import BookmarkForm
-from models import Bookmark
+from .forms import BookmarkForm
+from .models import Bookmark
 
 
 @login_required

admin_tools/tests.py

-from __future__ import with_statement
 import warnings
 from unittest import TestCase
 

admin_tools/utils.py

         'admin_tools.dashboard.dashboards.DefaultIndexDashboard'
     )
 
-    if type(dashboard_cls) is types.DictType:
+    if type(dashboard_cls) is dict:
         if context:
             request = context.get('request')
         curr_url = request.META['PATH_INFO']
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.