From 4dabdbe11ddc47a885c7f8cc6b3f26439d40d77c Mon Sep 17 00:00:00 2001 From: David Reyna Date: Wed, 25 Mar 2020 21:24:55 -0700 Subject: bitbake: toaster: migrate to Django-2.2 Toaster migration to Django-2.2. Django-1.x has been deprecated. [YOCTO #13207] (Bitbake rev: 9730f95686b2ac72cf1fa513c555f7c7787e2667) Signed-off-by: David Reyna Signed-off-by: Richard Purdie --- .../toastermain/management/commands/buildimport.py | 2 +- bitbake/lib/toaster/toastermain/settings.py | 17 ++++++++--------- bitbake/lib/toaster/toastermain/urls.py | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'bitbake/lib/toaster/toastermain') diff --git a/bitbake/lib/toaster/toastermain/management/commands/buildimport.py b/bitbake/lib/toaster/toastermain/management/commands/buildimport.py index 3e246fda83..7718caa57a 100644 --- a/bitbake/lib/toaster/toastermain/management/commands/buildimport.py +++ b/bitbake/lib/toaster/toastermain/management/commands/buildimport.py @@ -466,7 +466,6 @@ class Command(BaseCommand): release_name = 'None' if not pl.layercommit.release else pl.layercommit.release.name print(" AFTER :ProjectLayer=%s,%s,%s,%s" % (pl.layercommit.layer.name,release_name,pl.layercommit.branch,pl.layercommit.commit)) - def handle(self, *args, **options): project_name = options['name'] project_path = options['path'] @@ -551,6 +550,7 @@ class Command(BaseCommand): # preset the mode and default image recipe project.set_variable(Project.PROJECT_SPECIFIC_ISNEW,Project.PROJECT_SPECIFIC_NEW) project.set_variable(Project.PROJECT_SPECIFIC_DEFAULTIMAGE,"core-image-minimal") + # Assert any extended/custom actions or variables for new non-Toaster projects if not len(self.toaster_vars): pass diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index 74501fa26b..a4b370c8d4 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py @@ -189,15 +189,16 @@ TEMPLATES = [ }, ] -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = [ 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', - # Uncomment the next line for simple clickjacking protection: - # 'django.middleware.clickjacking.XFrameOptionsMiddleware', -) + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', +] CACHES = { # 'default': { @@ -248,7 +249,7 @@ FRESH_ENABLED = False if os.environ.get('TOASTER_DEVEL', None) is not None: try: import fresh - MIDDLEWARE_CLASSES = ("fresh.middleware.FreshMiddleware",) + MIDDLEWARE_CLASSES + MIDDLEWARE = ["fresh.middleware.FreshMiddleware",] + MIDDLEWARE INSTALLED_APPS = INSTALLED_APPS + ('fresh',) FRESH_ENABLED = True except: @@ -258,8 +259,8 @@ DEBUG_PANEL_ENABLED = False if os.environ.get('TOASTER_DEVEL', None) is not None: try: import debug_toolbar, debug_panel - MIDDLEWARE_CLASSES = ('debug_panel.middleware.DebugPanelMiddleware',) + MIDDLEWARE_CLASSES - #MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + ('debug_toolbar.middleware.DebugToolbarMiddleware',) + MIDDLEWARE = ['debug_panel.middleware.DebugPanelMiddleware',] + MIDDLEWARE + #MIDDLEWARE = MIDDLEWARE + ['debug_toolbar.middleware.DebugToolbarMiddleware',] INSTALLED_APPS = INSTALLED_APPS + ('debug_toolbar','debug_panel',) DEBUG_PANEL_ENABLED = True @@ -352,5 +353,3 @@ def activate_synchronous_off(sender, connection, **kwargs): connection_created.connect(activate_synchronous_off) # - - diff --git a/bitbake/lib/toaster/toastermain/urls.py b/bitbake/lib/toaster/toastermain/urls.py index ac77bc3632..5fb520b384 100644 --- a/bitbake/lib/toaster/toastermain/urls.py +++ b/bitbake/lib/toaster/toastermain/urls.py @@ -51,7 +51,7 @@ if toastermain.settings.DEBUG_PANEL_ENABLED: urlpatterns = [ # Uncomment the next line to enable the admin: - url(r'^admin/', include(admin.site.urls)), + url(r'^admin/', admin.site.urls), ] + urlpatterns # Automatically discover urls.py in various apps, beside our own @@ -69,7 +69,7 @@ for t in os.walk(os.path.dirname(currentdir)): # make sure we don't have this module name in conflict = False for p in urlpatterns: - if p.regex.pattern == '^' + modulename + '/': + if p.pattern.regex.pattern == '^' + modulename + '/': conflict = True if not conflict: urlpatterns.insert(0, url(r'^' + modulename + '/', include ( modulename + '.urls'))) -- cgit v1.2.3-54-g00ecf