mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-03-16 22:20:24 +00:00
Merge pull request #417 from montiniz/py3-fix
Raise syntax no longer accepts comma-separated arguments in python3
This commit is contained in:
commit
d69729e52f
2 changed files with 23 additions and 1 deletions
|
|
@ -65,3 +65,21 @@ class ModelAdminTest(TestCase):
|
|||
'paginate_by',
|
||||
admin_instance.get_index_kwargs().keys()
|
||||
)
|
||||
|
||||
def test_get_urls(self):
|
||||
admin_instance = ModelAdmin2(BigThing, Admin2)
|
||||
self.assertEqual(6, len(admin_instance.get_urls()))
|
||||
|
||||
def test_get_urls_throws_type_error(self):
|
||||
with self.assertRaises(TypeError):
|
||||
try:
|
||||
admin_instance = ModelAdmin2(BigThing, Admin2)
|
||||
admin_instance.views = [views.AdminView(None, None, None)]
|
||||
admin_instance.get_urls()
|
||||
|
||||
except TypeError as e:
|
||||
message = u"Cannot instantiate admin view " \
|
||||
'"ModelAdmin2.None". The error that got raised was: ' \
|
||||
"'NoneType' object has no attribute 'as_view'"
|
||||
self.assertEqual(e.args[0], message)
|
||||
raise
|
||||
|
|
|
|||
|
|
@ -224,7 +224,11 @@ class ModelAdmin2(with_metaclass(ModelAdminBase2)):
|
|||
'Cannot instantiate admin view "{}.{}". '
|
||||
'The error that got raised was: {}'.format(
|
||||
self.__class__.__name__, admin_view.name, e))
|
||||
raise (new_exception, None, trace)
|
||||
try:
|
||||
raise new_exception.with_traceback(trace)
|
||||
except AttributeError:
|
||||
raise (new_exception, None, trace)
|
||||
|
||||
pattern_list.append(
|
||||
url(
|
||||
regex=admin_view.url,
|
||||
|
|
|
|||
Loading…
Reference in a new issue