예제 #1
0
    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')
예제 #2
0
 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)
예제 #3
0
 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)
예제 #4
0
 def _to_python(self, value, state):
     if not value:
         return None
     return Language.get(value) or self._notfoundmarker
예제 #5
0
 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'))
예제 #6
0
 def delete_language(self, id):
     c.language  = Language.get(id)
     meta.Session.delete(c.language)
     meta.Session.commit()
     redirect(url(controller='admin', action='languages'))