Ejemplo n.º 1
0
    def delete(self):
        """Delete a specific language"""
        if not users.is_current_user_admin():
            self.error(403)

        language_id = self.request.path.split('/')[-1]
        language = Language.get_by_id(int(language_id))

        if language:
            language.delete()
            init_cached_languages()
            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write('success');
        else:
            self.error(404)
Ejemplo n.º 2
0
    def delete(self):
        """Delete a specific language"""
        if not users.is_current_user_admin():
            self.error(403)

        language_id = self.request.path.split('/')[-1]
        language = Language.get_by_id(int(language_id))

        if language:
            language.delete()
            init_cached_languages()
            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write('success')
        else:
            self.error(404)
Ejemplo n.º 3
0
    def post(self):
        """Update a specific language"""
        if not users.is_current_user_admin():
            self.error(403)

        language_id = self.request.path.split('/')[-1]
        language = Language.get_by_id(int(language_id))

        if language:
            language.enabled_in_tool = self.request.get('enabled_in_tool') == 'true'
            language.enabled_on_site = self.request.get('enabled_on_site') == 'true'

            language.save()

            init_cached_languages()

            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write('success');
        else:
            self.error(404)
Ejemplo n.º 4
0
    def post(self):
        """Update a specific language"""
        if not users.is_current_user_admin():
            self.error(403)

        language_id = self.request.path.split("/")[-1]
        language = Language.get_by_id(int(language_id))

        if language:
            language.enabled_in_tool = self.request.get("enabled_in_tool") == "true"
            language.enabled_on_site = self.request.get("enabled_on_site") == "true"

            language.save()

            init_cached_languages()

            self.response.headers["Content-Type"] = "text/plain"
            self.response.out.write("success")
        else:
            self.error(404)
Ejemplo n.º 5
0
    def post(self):
        """Update a specific language"""
        if not users.is_current_user_admin():
            self.error(403)

        language_id = self.request.path.split('/')[-1]
        language = Language.get_by_id(int(language_id))

        if language:
            language.enabled_in_tool = self.request.get(
                'enabled_in_tool') == 'true'
            language.enabled_on_site = self.request.get(
                'enabled_on_site') == 'true'

            language.save()

            init_cached_languages()

            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write('success')
        else:
            self.error(404)