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 import __version__
|
||||||
from wagtail.wagtailcore.models import Page
|
from wagtail.wagtailcore.models import Page
|
||||||
from wagtail.wagtailcore.rich_text import RichText, expand_db_html
|
from wagtail.wagtailcore.rich_text import RichText, expand_db_html
|
||||||
from wagtail.wagtailcore.utils import accepts_kwarg
|
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
@ -25,16 +24,11 @@ def pageurl(context, page):
|
|||||||
# request.site not available in the current context; fall back on page.url
|
# request.site not available in the current context; fall back on page.url
|
||||||
return page.url
|
return page.url
|
||||||
|
|
||||||
# RemovedInWagtail113Warning - this accepts_kwarg test can be removed when we drop support
|
# Pass page.relative_url the request object, which may contain a cached copy of
|
||||||
# for relative_url methods which omit the `request` kwarg
|
# Site.get_site_root_paths()
|
||||||
if accepts_kwarg(page.relative_url, 'request'):
|
# This avoids page.relative_url having to make a database/cache fetch for this list
|
||||||
# Pass page.relative_url the request object, which may contain a cached copy of
|
# each time it's called.
|
||||||
# Site.get_site_root_paths()
|
return page.relative_url(current_site, request=context.get('request'))
|
||||||
# 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)
|
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag(takes_context=True)
|
@register.simple_tag(takes_context=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user