Ignore:
Timestamp:
15 Dec 2014, 11:18:31 (10 years ago)
Author:
Henrik Bettermann
Message:

Redirect to portal root if content is not yet published.

Extend tests.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/documents
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/browser.py

    r12242 r12243  
    202202            self.flash(_('The document requested has not yet been published.'),
    203203                type="warning")
    204             self.redirect(self.url(self.context))
     204            self.redirect(self.application_url())
    205205        super(HTMLDocumentDisplayContentPage, self).update()
    206206        return
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/fileviewlets.py

    r12241 r12243  
    6969            self.flash(_('The document requested has not yet been published.'),
    7070                type="warning")
    71             self.redirect(self.url(self.context))
     71            self.redirect(self.application_url())
    7272        return
  • main/waeup.ikoba/trunk/src/waeup/ikoba/documents/tests/test_browser.py

    r12240 r12243  
    158158            in self.browser.contents)
    159159        IWorkflowState(document).setState(PUBLISHED)
    160         self.browser.getLink("sample.pdf").click()
     160        self.browser.open(self.container_path + '/d101/sample.pdf')
    161161        self.assertEqual(
    162162            self.browser.headers['content-type'], 'application/pdf')
     
    240240        self.assertTrue(
    241241            '<h1>Hallo Welt</h1>' in self.browser.contents)
     242        # The content can't be rendered yet
     243        self.browser.open(self.container_path + '/d101/display')
     244        self.assertTrue(
     245            'The document requested has not yet been published'
     246            in self.browser.contents)
     247        # We have been redirected to the portal root
     248        self.assertEqual(self.browser.url, 'http://localhost/app')
    242249
    243250        # Transitions can be performed
     
    248255        self.assertEqual(document.state, 'published')
    249256
     257        # The content can be rendered
     258        self.browser.open(self.container_path + '/d101/display')
     259        self.assertTrue(
     260            '<h1>Hallo Welt</h1>' in self.browser.contents)
     261
    250262        # Documents can be removed
    251263        self.browser.getLink("en", index=2).click()
Note: See TracChangeset for help on using the changeset viewer.