示例#1
0
    def get(self, spaceName, pageUrl):
        currentSpace = spaceservice.getSpace(spaceName)
        if currentSpace:
            currentUser = self.getCurrentUser()
            requestWrapper = RequestWrapper(currentUser, self.request)

            currentPage = spaceservice.getPage(currentSpace, pageUrl);
            pageRenderer = renderer.PageRenderer(currentPage, requestWrapper, self.response)
            themeTemplate = template.load(os.path.join('template','theme', currentSpace.theme.name + '.html'))
            
            self.response.out.write(themeTemplate.render(template.Context({'page': pageRenderer})))

            if requestWrapper.uri:
                self.redirect(requestWrapper.uri)
        else:
            self.response.out.write(configuration.getMessage('space.not.found'))
示例#2
0
文件: login.py 项目: dvaumoron/Scrap
def process(request, response):
    if request.currentUser.isGuestUser():
        return "<a href='%s'>%s</a>" % (users.create_login_url(request.request.uri), configuration.getMessage('login'))
    else:
        return "<a href='%s'>%s</a>" % (users.create_logout_url("/"), configuration.getMessage('logout'))