def get(self):

        role = self.session.get('role')
        user_session = self.session.get("user")

        if role != "admin" and role != "staff":
            self.redirect("/users/login?message={0}".format(
                "You are not authorized to view this page"))
            return

        if not self.legacy:
            self.redirect("/#/admin/programs/new")

        form = Program.NewProgramForm()
        template_values = {"form": form, "user_session": user_session}
        language = None
        if "language" in self.request.cookies:
            language = self.request.cookies["language"]
        else:
            language = "fr"
            self.response.set_cookie("language", "fr")

        language = language.replace('"', '').replace("'", "")
        if language == "fr":

            LEGACY_TEMPLATE = JINJA_ENVIRONMENT.get_template(
                'fr_new_programs.html')
        else:
            LEGACY_TEMPLATE = JINJA_ENVIRONMENT.get_template(
                'new_programs.html')
        self.response.write(LEGACY_TEMPLATE.render(template_values))
 def post(self):
     form = Program.NewProgramForm(self.request.POST)
     if form.validate():
         user = Program.save(self, form, LEGACY_TEMPLATE)
     else:
         self.response.write(LEGACY_TEMPLATE.render({"form": form}))