From cff19351a8b9d6267177dc548d994e3f28590391 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Thu, 26 Jun 2014 15:21:42 +0100 Subject: bitbake: toaster: add project pages We add the new project and project page skeletons. In the process, we add an identifier in the settings.py to detect whenever Toaster is running in managed mode, and a context processor to make this value available to the template processor. (Bitbake rev: 927a27c68e24cfe13f62ca5f0e60878b04fa4e24) Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/views.py | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'bitbake/lib/toaster/toastergui/views.py') diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 1f3e11d57c..7dc0108393 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -1758,3 +1758,41 @@ def image_information_dir(request, build_id, target_id, packagefile_id): # stubbed for now return redirect(builds) + +import toastermain.settings +def managedcontextprocessor(request): + return { "MANAGED" : toastermain.settings.MANAGED } + + +# we have a set of functions if we're in managed mode, or +# a default "page not available" simple functions for interactive mode +if toastermain.settings.MANAGED: + + # new project + def newproject(request): + template = "newproject.html" + context = {} + if request.method == "GET": + # render new project page + return render(request, template, context) + elif request.method == "POST": + if request.method: + return redirect(project) + else: + return render(request, template, context) + raise Exception("Invalid HTTP method for this page") + + # Shows the edit project page + def project(request): + template = "project.html" + context = {} + return render(request, template, context) + + +else: + # these are pages that are NOT available in interactive mode + def newproject(request): + raise Exception("page not available in interactive mode") + + def project(request): + raise Exception("page not available in interactive mode") -- cgit v1.2.3-54-g00ecf