コード例 #1
0
ファイル: view.py プロジェクト: honten/diary
    def full_render(self, handler,template_file, params={}):
            scheme, netloc, path, query, fragment = urlparse.urlsplit(handler.request.uri)
            administrator = False
            if users.get_current_user():
                url = users.create_logout_url(handler.request.uri)
                url_linktext = 'Sign out'
                if users.is_current_user_admin():
                    administrator = True
            else:
                url = users.create_login_url(handler.request.uri)
                url_linktext = 'Sign in'
            cpedialog = util.getCPedialog()
            delicious = None
            if cpedialog.delicious_enable:
                delicious = util.getDeliciousTag(cpedialog.delicious_username)
            feeds = None
            if cpedialog.google_ajax_feed_enable:
                feeds = util.getFeedList()
            template_params = {
                "title": cpedialog.title,
                "current_url": url,
                'user': users.GetCurrentUser(),
                'url': url,
                'url_linktext': url_linktext,
                'administrator': administrator,
                'request': handler.request,

                "user_is_admin": users.is_current_user_admin(),
                "login_url": users.create_login_url(handler.request.uri),
                "logout_url": users.create_logout_url(handler.request.uri),
                'logoImages': cpedialog.get_logo_images_list(),
                "BLOG": cpedialog,
                "nav_menus": util.getMenuList(),
                "tags": util.getTagList(),
                "feeds": feeds,
                "delicious": delicious,
                "user_gravatar_url":util.getGravatarUrlByUser(users.get_current_user()),
                "user_nickname":util.getUserNickname(users.get_current_user())
               # "docs": util.getGoogleDocs(config.delicious['username']),
            }
            template_params.update(params)
            return template.render(template_file, template_params, debug=cpedialog.debug)