Beispiel #1
0
    def test_can_update_locale(self):
        user = UserFactory.create(locale='es_ES')

        loaded_user = User.by_email(user.email, self.db)
        expect(loaded_user.id).to_equal(user.id)
        expect(loaded_user.locale).to_equal('es_ES')

        User.update_locale(self.db, user, 'pt_BR')

        loaded_user = User.by_email(user.email, self.db)
        expect(loaded_user.id).to_equal(user.id)
        expect(loaded_user.locale).to_equal('pt_BR')
Beispiel #2
0
    def post(self):
        user = self.get_authenticated_user()

        if not user:
            return

        post_data = loads(self.request.body)
        locale = post_data.get('locale', None)

        if locale:
            User.update_locale(self.db, user, locale)

        self.write_json(self._('OK'))
        self.finish()
Beispiel #3
0
    def post(self):
        user = self.get_authenticated_user()

        if not user:
            return

        post_data = loads(self.request.body)
        locale = post_data.get('locale', None)

        if locale:
            User.update_locale(self.db, user, locale)

        self.write_json(self._('OK'))
        self.finish()