mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-29 17:36:49 +01:00
Remove check for relative_url without a request kwarg from the pageurl tag
This commit is contained in:
parent
925171d72b
commit
248b95d3f5
@ -8,7 +8,6 @@ from django.utils.safestring import mark_safe
|
||||
from wagtail import __version__
|
||||
from wagtail.wagtailcore.models import Page
|
||||
from wagtail.wagtailcore.rich_text import RichText, expand_db_html
|
||||
from wagtail.wagtailcore.utils import accepts_kwarg
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@ -25,16 +24,11 @@ def pageurl(context, page):
|
||||
# request.site not available in the current context; fall back on page.url
|
||||
return page.url
|
||||
|
||||
# RemovedInWagtail113Warning - this accepts_kwarg test can be removed when we drop support
|
||||
# for relative_url methods which omit the `request` kwarg
|
||||
if accepts_kwarg(page.relative_url, 'request'):
|
||||
# Pass page.relative_url the request object, which may contain a cached copy of
|
||||
# Site.get_site_root_paths()
|
||||
# This avoids page.relative_url having to make a database/cache fetch for this list
|
||||
# each time it's called.
|
||||
return page.relative_url(current_site, request=context.get('request'))
|
||||
else:
|
||||
return page.relative_url(current_site)
|
||||
# Pass page.relative_url the request object, which may contain a cached copy of
|
||||
# Site.get_site_root_paths()
|
||||
# This avoids page.relative_url having to make a database/cache fetch for this list
|
||||
# each time it's called.
|
||||
return page.relative_url(current_site, request=context.get('request'))
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
|
Loading…
Reference in New Issue
Block a user