コード例 #1
0
    def get(self, profile_email):
        """
        GET request handler that renders a profile overview page.

        @param profile_email: The email address of the user whose profile's
                              overview page should be rendered.
        @type profile_email: str
        """
        cur_user = users.get_current_user()
        if not account_facade.viewer_has_access(cur_user, profile_email):
            self.redirect(constants.HOME_URL)

        section_statuses = account_facade.get_updated_sections(
            cur_user, profile_email)
        sections = constants.PORTFOLIO_SECTIONS
        account_facade.set_viewed(cur_user, profile_email, None)

        template = jinja_environment.get_template("portfolio_overview.html")
        template_vals = get_standard_template_dict()
        owner_name = util.get_full_name_from_email(profile_email)
        template_vals["profile_safe_email"] = util.sanitize_email(profile_email)
        template_vals["cur_section"] = "overview"
        template_vals["owner_name"] = " ".join(owner_name)
        template_vals["owner_first_name"] = owner_name[0]
        template_vals["owner_last_name"] = owner_name[1]
        template_vals["sections"] = sections
        template_vals["section_statuses"] = section_statuses
        content = template.render(template_vals)
        self.response.out.write(content)
コード例 #2
0
    def get(self, profile_email, section_name):
        """
        GET request handler that renders the private comments for a section.

        @param profile_email: The email address of the user whose portfolio's
                              comments should be displayed.
        @type profile_email: str
        @param section_name: The name of the portfolio section to render
                             comments for.
        @type section_name: str
        """
        cur_user = users.get_current_user()
        if not account_facade.viewer_has_access(cur_user, profile_email):
            self.redirect(constants.HOME_URL)

        new_comments = account_facade.get_new_comments(
            cur_user, profile_email, section_name)
        old_comments = account_facade.get_old_comments(
            cur_user, profile_email, section_name)

        section_statuses = account_facade.get_updated_sections(
            cur_user, profile_email)
        sections = constants.PORTFOLIO_SECTIONS
        account_facade.set_viewed(cur_user, profile_email, section_name)

        template = jinja_environment.get_template("portfolio_section.html")
        template_vals = get_standard_template_dict()
        owner_name = util.get_full_name_from_email(profile_email)
        template_vals["profile_safe_email"] = util.sanitize_email(profile_email)
        template_vals["cur_section"] = section_name
        template_vals["owner_name"] = " ".join(owner_name)
        template_vals["owner_first_name"] = owner_name[0]
        template_vals["owner_last_name"] = owner_name[1]
        template_vals["sections"] = sections
        template_vals["section_statuses"] = section_statuses
        template_vals["new_comments"] = new_comments
        template_vals["old_comments"] = old_comments
        content = template.render(template_vals)
        self.response.out.write(content)