Skip to content

Commit

Permalink
toaster: Add BUILD_MODE flag to context
Browse files Browse the repository at this point in the history
We set a TOASTER_MANAGED env variable in the startup script,
which has a value of "1" if Toaster should run in build mode.

Add a BUILD_MODE variable to settings.py which is True if
TOASTER_MANAGED is set to "1", False otherwise.

Add this to the context for every template, so we can use this
information to conditionally alter the content of pages
according to the mode we're in.

[YOCTO #8514]

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
  • Loading branch information
townxelliot authored and rpurdie committed Oct 27, 2015
1 parent ef69be3 commit f9cf473
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 4 additions & 0 deletions lib/toaster/toastergui/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,10 @@ def managedcontextprocessor(request):
"projects": projects,
"non_cli_projects": projects.exclude(is_default=True),
"DEBUG" : toastermain.settings.DEBUG,

# True if Toaster is in build mode, False otherwise
"BUILD_MODE": toastermain.settings.BUILD_MODE,

"CUSTOM_IMAGE" : toastermain.settings.CUSTOM_IMAGE,
"TOASTER_BRANCH": toastermain.settings.TOASTER_BRANCH,
"TOASTER_REVISION" : toastermain.settings.TOASTER_REVISION,
Expand Down
6 changes: 2 additions & 4 deletions lib/toaster/toastermain/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,9 @@
else:
raise Exception("FIXME: Please implement missing database url schema for url: %s" % dburl)


BUILD_MODE = False
if 'TOASTER_MANAGED' in os.environ and os.environ['TOASTER_MANAGED'] == "1":
MANAGED = True
else:
MANAGED = False
BUILD_MODE = True

# Allows current database settings to be exported as a DATABASE_URL environment variable value

Expand Down
2 changes: 1 addition & 1 deletion lib/toaster/toastermain/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#logger.info("Enabled django_toolbar extension")


if toastermain.settings.MANAGED:
if toastermain.settings.BUILD_MODE:
urlpatterns = [
# Uncomment the next line to enable the admin:
url(r'^admin/', include(admin.site.urls)),
Expand Down

0 comments on commit f9cf473

Please sign in to comment.