コード例 #1
0
    def get(self, user_id):
        user_api = BoruvkaUserApi(self.dao)

        viewer_id = self.session['user_id']

        user = user_api.get_user(id=user_id)

        setting_query = BoruvkaSettingQuery(self.dao)

        user_settings = setting_query.get_user_settings(user_id)
        allowed_settings = setting_query.get_settings()

        viewer_settings = setting_query.get_user_settings(viewer_id)
        translation = viewer_settings['language']
        view = BoruvkaUserEditView(
            translation=translation,
        )

        view._full = not self.request.is_xhr
        view._user = user
        view._settings = allowed_settings
        view._user_settings = user_settings

        response = Response()
        response.body = view.render()
        return response
コード例 #2
0
    def get(self, user_id):
        api = BoruvkaUserApi(self.dao)

        user = api.get_user(id=user_id)

        # TODO: move translations handling to BaseController
        translation = list(self.request.accept_language)[0]
        view = BoruvkaUserShowView(translation=translation)

        view._full = not self.request.is_xhr
        view._user = user

        response = Response()
        response.body = view.render()
        return response
コード例 #3
0
    def get(self):
        user_id = self.session["user_id"]
        user_api = BoruvkaUserApi(self.dao)
        user = user_api.get_user(id=user_id)

        setting_query = BoruvkaSettingQuery(self.dao)
        user_settings = setting_query.get_user_settings(user_id)
        translation = user_settings["language"]
        view = BoruvkaHomeView(translation)

        view.user = user
        view._color = user_settings["color"]

        response = Response()
        response.body = view.render()
        return response