mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-11-29 11:44:28 +01:00
improvements in using six ; tests in modoboa.core in both python 2 and 3
This commit is contained in:
@@ -4,7 +4,7 @@ from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import include, url
|
||||
from django.utils import six
|
||||
from django.utils.encoding import smart_str
|
||||
|
||||
|
||||
class ModoExtension(object):
|
||||
@@ -79,11 +79,7 @@ class ExtensionsPool(object):
|
||||
|
||||
def load_extension(self, name):
|
||||
"""Load a registered extension."""
|
||||
if six.PY2:
|
||||
fromlist = ["modo_extension".encode()]
|
||||
else:
|
||||
fromlist = ["modo_extension"]
|
||||
__import__(name, locals(), globals(), fromlist)
|
||||
__import__(name, locals(), globals(), [smart_str('modo_extension')])
|
||||
extinstance = self.get_extension(name)
|
||||
if extinstance is None:
|
||||
return None
|
||||
@@ -137,4 +133,5 @@ class ExtensionsPool(object):
|
||||
result += [infos]
|
||||
return sorted(result, key=lambda i: i["name"])
|
||||
|
||||
|
||||
exts_pool = ExtensionsPool()
|
||||
|
||||
Reference in New Issue
Block a user