mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
pagination: this lstrip() was way too hungry, eating absolute URLs.
Reverts back to how pagination worked for the {url} placeholder as I did
it in 182fb11c80. Absolute URLs with
one or two leading slashes were eaten by lstrip() and became relative,
which then caused broken links in my case.
Added extra comments to this piece of code (*and* the test) to make it
less likely that someone breaks this again in the future.
This commit is contained in:
parent
b6d423d2b8
commit
ec2a1bd42a
2 changed files with 14 additions and 3 deletions
|
|
@ -72,9 +72,10 @@ class TestPage(unittest.TestCase):
|
|||
Article(**self.page_kwargs)]
|
||||
paginator = Paginator('blog/index.html', '//blog.my.site/',
|
||||
object_list, settings, 1)
|
||||
# The URL *has to* stay absolute (with // in the front), so verify that
|
||||
page1 = paginator.page(1)
|
||||
self.assertEqual(page1.save_as, 'blog/index.html')
|
||||
self.assertEqual(page1.url, 'blog.my.site/')
|
||||
self.assertEqual(page1.url, '//blog.my.site/')
|
||||
page2 = paginator.page(2)
|
||||
self.assertEqual(page2.save_as, 'blog/2/index.html')
|
||||
self.assertEqual(page2.url, 'blog.my.site/2/')
|
||||
self.assertEqual(page2.url, '//blog.my.site/2/')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue