def _edit_information_form(self, edit_language=None): c.tabs = self._edit_profile_tabs() c.current_tab = 'information' country = c.user.location.get_country() if country is not None: c.edit_languages = [country.language] if country.language.id != 'en': c.edit_languages.append(Language.get('en')) else: c.edit_languages = Language.all() c.edit_language = edit_language or self.form_result.get('language') return render('profile/teacher/edit_information.mako')
def _multilanguage(self, lang=None): language = None if lang is not None: language = Language.get(lang) if language is None: abort(404) return method(self, language)
def edit_language(self, id): c.language = Language.get(id) defaults = { 'id': c.language.id, 'title': c.language.title } return htmlfill.render(self._edit_language_form(), defaults)
def _to_python(self, value, state): if not value: return None return Language.get(value) or self._notfoundmarker
def update_language(self): if hasattr(self, 'form_result'): language = Language.get(self.form_result['id']) language.title = self.form_result['title'] meta.Session.commit() redirect(url(controller='admin', action='languages'))
def delete_language(self, id): c.language = Language.get(id) meta.Session.delete(c.language) meta.Session.commit() redirect(url(controller='admin', action='languages'))