prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Password reset request generates email with URL "example.com"
  Received:
  
  ```
  Please follow the link below to reset your password
  http://example.com/admin/password_reset/confirm/NA/3x7-cfc1f37209f0c04d1ee1/
  ```
  
  This time `BASE_URL` _is_ configured, but as this view is from django.contrib this is perhaps due to some other missing setting. 
  
  Related to #693 #826
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py`
  Content:
  ```
  1 from __future__ import unicode_literals
  2 
  3 import re
  4 
  5 from django.conf import settings
  6 from django import template
  7 from django.contrib.humanize.templatetags.humanize import intcomma
  8 
  9 from wagtail.wagtailcore import hooks
  10 from wagtail.wagtailcore.models import get_navigation_menu_items, UserPagePermissionsProxy, PageViewRestriction
  11 from wagtail.wagtailcore.utils import camelcase_to_underscore
  12 from wagtail.wagtailadmin.menu import admin_menu
  13 
  14 
  15 register = template.Library()
  16 
  17 register.filter('intcomma', intcomma)
  18 
  19 @register.inclusion_tag('wagtailadmin/shared/explorer_nav.html')
  20 def explorer_nav():
  21     return {
  22         'nodes': get_navigation_menu_items()
  23     }
  24 
  25 
  26 @register.inclusion_tag('wagtailadmin/shared/explorer_nav_child.html')
  27 def explorer_subnav(nodes):
  28     return {
  29         'nodes': nodes
  30     }
  31 
  32 
  33 @register.inclusion_tag('wagtailadmin/shared/main_nav.html', takes_context=True)
  34 def main_nav(context):
  35     request = context['request']
  36 
  37     return {
  38         'menu_html': admin_menu.render_html(request),
  39         'request': request,
  40     }
  41 
  42 @register.simple_tag
  43 def main_nav_js():
  44     return admin_menu.media['js']
  45 
  46 
  47 @register.filter("ellipsistrim")
  48 def ellipsistrim(value, max_length):
  49     if len(value) > max_length:
  50         truncd_val = value[:max_length]
  51         if not len(value) == max_length+1 and value[max_length+1] != " ":
  52             truncd_val = truncd_val[:truncd_val.rfind(" ")]
  53         return truncd_val + "..."
  54     return value
  55 
  56 
  57 @register.filter
  58 def fieldtype(bound_field):
  59     try:
  60         return camelcase_to_underscore(bound_field.field.__class__.__name__)
  61     except AttributeError:
  62         try:
  63             return camelcase_to_underscore(bound_field.__class__.__name__)
  64         except AttributeError:
  65             return ""
  66 
  67 
  68 @register.filter
  69 def widgettype(bound_field):
  70     try:
  71         return camelcase_to_underscore(bound_field.field.widget.__class__.__name__)
  72     except AttributeError:
  73         return ""
  74 
  75 
  76 @register.filter
  77 def meta_description(model):
  78     try:
  79         return model.model_class()._meta.description
  80     except:
  81         return ""
  82 
  83 
  84 @register.assignment_tag(takes_context=True)
  85 def page_permissions(context, page):
  86     """
  87     Usage: {% page_permissions page as page_perms %}
  88     Sets the variable 'page_perms' to a PagePermissionTester object that can be queried to find out
  89     what actions the current logged-in user can perform on the given page.
  90     """
  91     # Create a UserPagePermissionsProxy object to represent the user's global permissions, and
  92     # cache it in the context for the duration of the page request, if one does not exist already
  93     if 'user_page_permissions' not in context:
  94         context['user_page_permissions'] = UserPagePermissionsProxy(context['request'].user)
  95 
  96     # Now retrieve a PagePermissionTester from it, specific to the given page
  97     return context['user_page_permissions'].for_page(page)
  98 
  99 
  100 @register.assignment_tag(takes_context=True)
  101 def test_page_is_public(context, page):
  102     """
  103     Usage: {% test_page_is_public page as is_public %}
  104     Sets 'is_public' to True iff there are no page view restrictions in place on
  105     this page.
  106     Caches the list of page view restrictions in the context, to avoid repeated
  107     DB queries on repeated calls.
  108     """
  109     if 'all_page_view_restriction_paths' not in context:
  110         context['all_page_view_restriction_paths'] = PageViewRestriction.objects.select_related('page').values_list('page__path', flat=True)
  111 
  112     is_private = any([
  113         page.path.startswith(restricted_path)
  114         for restricted_path in context['all_page_view_restriction_paths']
  115     ])
  116 
  117     return not is_private
  118 
  119 
  120 @register.simple_tag
  121 def hook_output(hook_name):
  122     """
  123     Example: {% hook_output 'insert_editor_css' %}
  124     Whenever we have a hook whose functions take no parameters and return a string, this tag can be used
  125     to output the concatenation of all of those return values onto the page.
  126     Note that the output is not escaped - it is the hook function's responsibility to escape unsafe content.
  127     """
  128     snippets = [fn() for fn in hooks.get_hooks(hook_name)]
  129     return ''.join(snippets)
  130 
  131 
  132 @register.assignment_tag
  133 def usage_count_enabled():
  134     return getattr(settings, 'WAGTAIL_USAGE_COUNT_ENABLED', False)
  135 
  136 
  137 class EscapeScriptNode(template.Node):
  138     TAG_NAME = 'escapescript'
  139     SCRIPT_RE = re.compile(r'<(-*)/script>')
  140 
  141     def __init__(self, nodelist):
  142         super(EscapeScriptNode, self).__init__()
  143         self.nodelist = nodelist
  144 
  145     def render(self, context):
  146         out = self.nodelist.render(context)
  147         escaped_out = self.SCRIPT_RE.sub(r'<-\1/script>', out)
  148         return escaped_out
  149 
  150     @classmethod
  151     def handle(cls, parser, token):
  152         nodelist = parser.parse(('end' + EscapeScriptNode.TAG_NAME,))
  153         parser.delete_first_token()
  154         return cls(nodelist)
  155 
  156 register.tag(EscapeScriptNode.TAG_NAME, EscapeScriptNode.handle)
  157
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py b/wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py
  --- a/wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py
  +++ b/wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py
  @@ -134,6 +134,11 @@
       return getattr(settings, 'WAGTAIL_USAGE_COUNT_ENABLED', False)
   
   
  +@register.assignment_tag
  +def base_url_setting():
  +    return getattr(settings, 'BASE_URL', None)
  +
  +
   class EscapeScriptNode(template.Node):
       TAG_NAME = 'escapescript'
       SCRIPT_RE = re.compile(r'<(-*)/script>')
  
verification_info: {"golden_diff": "diff --git a/wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py b/wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py\n--- a/wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py\n+++ b/wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py\n@@ -134,6 +134,11 @@\n     return getattr(settings, 'WAGTAIL_USAGE_COUNT_ENABLED', False)\n \n \n+@register.assignment_tag\n+def base_url_setting():\n+    return getattr(settings, 'BASE_URL', None)\n+\n+\n class EscapeScriptNode(template.Node):\n     TAG_NAME = 'escapescript'\n     SCRIPT_RE = re.compile(r'<(-*)/script>')\n", "issue": "Password reset request generates email with URL \"example.com\"\nReceived:\n\n```\nPlease follow the link below to reset your password\nhttp://example.com/admin/password_reset/confirm/NA/3x7-cfc1f37209f0c04d1ee1/\n```\n\nThis time `BASE_URL` _is_ configured, but as this view is from django.contrib this is perhaps due to some other missing setting. \n\nRelated to #693 #826\n\n", "before_files": [{"content": "from __future__ import unicode_literals\n\nimport re\n\nfrom django.conf import settings\nfrom django import template\nfrom django.contrib.humanize.templatetags.humanize import intcomma\n\nfrom wagtail.wagtailcore import hooks\nfrom wagtail.wagtailcore.models import get_navigation_menu_items, UserPagePermissionsProxy, PageViewRestriction\nfrom wagtail.wagtailcore.utils import camelcase_to_underscore\nfrom wagtail.wagtailadmin.menu import admin_menu\n\n\nregister = template.Library()\n\nregister.filter('intcomma', intcomma)\n\n@register.inclusion_tag('wagtailadmin/shared/explorer_nav.html')\ndef explorer_nav():\n    return {\n        'nodes': get_navigation_menu_items()\n    }\n\n\n@register.inclusion_tag('wagtailadmin/shared/explorer_nav_child.html')\ndef explorer_subnav(nodes):\n    return {\n        'nodes': nodes\n    }\n\n\n@register.inclusion_tag('wagtailadmin/shared/main_nav.html', takes_context=True)\ndef main_nav(context):\n    request = context['request']\n\n    return {\n        'menu_html': admin_menu.render_html(request),\n        'request': request,\n    }\n\n@register.simple_tag\ndef main_nav_js():\n    return admin_menu.media['js']\n\n\n@register.filter(\"ellipsistrim\")\ndef ellipsistrim(value, max_length):\n    if len(value) > max_length:\n        truncd_val = value[:max_length]\n        if not len(value) == max_length+1 and value[max_length+1] != \" \":\n            truncd_val = truncd_val[:truncd_val.rfind(\" \")]\n        return truncd_val + \"...\"\n    return value\n\n\n@register.filter\ndef fieldtype(bound_field):\n    try:\n        return camelcase_to_underscore(bound_field.field.__class__.__name__)\n    except AttributeError:\n        try:\n            return camelcase_to_underscore(bound_field.__class__.__name__)\n        except AttributeError:\n            return \"\"\n\n\n@register.filter\ndef widgettype(bound_field):\n    try:\n        return camelcase_to_underscore(bound_field.field.widget.__class__.__name__)\n    except AttributeError:\n        return \"\"\n\n\n@register.filter\ndef meta_description(model):\n    try:\n        return model.model_class()._meta.description\n    except:\n        return \"\"\n\n\n@register.assignment_tag(takes_context=True)\ndef page_permissions(context, page):\n    \"\"\"\n    Usage: {% page_permissions page as page_perms %}\n    Sets the variable 'page_perms' to a PagePermissionTester object that can be queried to find out\n    what actions the current logged-in user can perform on the given page.\n    \"\"\"\n    # Create a UserPagePermissionsProxy object to represent the user's global permissions, and\n    # cache it in the context for the duration of the page request, if one does not exist already\n    if 'user_page_permissions' not in context:\n        context['user_page_permissions'] = UserPagePermissionsProxy(context['request'].user)\n\n    # Now retrieve a PagePermissionTester from it, specific to the given page\n    return context['user_page_permissions'].for_page(page)\n\n\n@register.assignment_tag(takes_context=True)\ndef test_page_is_public(context, page):\n    \"\"\"\n    Usage: {% test_page_is_public page as is_public %}\n    Sets 'is_public' to True iff there are no page view restrictions in place on\n    this page.\n    Caches the list of page view restrictions in the context, to avoid repeated\n    DB queries on repeated calls.\n    \"\"\"\n    if 'all_page_view_restriction_paths' not in context:\n        context['all_page_view_restriction_paths'] = PageViewRestriction.objects.select_related('page').values_list('page__path', flat=True)\n\n    is_private = any([\n        page.path.startswith(restricted_path)\n        for restricted_path in context['all_page_view_restriction_paths']\n    ])\n\n    return not is_private\n\n\n@register.simple_tag\ndef hook_output(hook_name):\n    \"\"\"\n    Example: {% hook_output 'insert_editor_css' %}\n    Whenever we have a hook whose functions take no parameters and return a string, this tag can be used\n    to output the concatenation of all of those return values onto the page.\n    Note that the output is not escaped - it is the hook function's responsibility to escape unsafe content.\n    \"\"\"\n    snippets = [fn() for fn in hooks.get_hooks(hook_name)]\n    return ''.join(snippets)\n\n\n@register.assignment_tag\ndef usage_count_enabled():\n    return getattr(settings, 'WAGTAIL_USAGE_COUNT_ENABLED', False)\n\n\nclass EscapeScriptNode(template.Node):\n    TAG_NAME = 'escapescript'\n    SCRIPT_RE = re.compile(r'<(-*)/script>')\n\n    def __init__(self, nodelist):\n        super(EscapeScriptNode, self).__init__()\n        self.nodelist = nodelist\n\n    def render(self, context):\n        out = self.nodelist.render(context)\n        escaped_out = self.SCRIPT_RE.sub(r'<-\\1/script>', out)\n        return escaped_out\n\n    @classmethod\n    def handle(cls, parser, token):\n        nodelist = parser.parse(('end' + EscapeScriptNode.TAG_NAME,))\n        parser.delete_first_token()\n        return cls(nodelist)\n\nregister.tag(EscapeScriptNode.TAG_NAME, EscapeScriptNode.handle)\n", "path": "wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py"}], "after_files": [{"content": "from __future__ import unicode_literals\n\nimport re\n\nfrom django.conf import settings\nfrom django import template\nfrom django.contrib.humanize.templatetags.humanize import intcomma\n\nfrom wagtail.wagtailcore import hooks\nfrom wagtail.wagtailcore.models import get_navigation_menu_items, UserPagePermissionsProxy, PageViewRestriction\nfrom wagtail.wagtailcore.utils import camelcase_to_underscore\nfrom wagtail.wagtailadmin.menu import admin_menu\n\n\nregister = template.Library()\n\nregister.filter('intcomma', intcomma)\n\n@register.inclusion_tag('wagtailadmin/shared/explorer_nav.html')\ndef explorer_nav():\n    return {\n        'nodes': get_navigation_menu_items()\n    }\n\n\n@register.inclusion_tag('wagtailadmin/shared/explorer_nav_child.html')\ndef explorer_subnav(nodes):\n    return {\n        'nodes': nodes\n    }\n\n\n@register.inclusion_tag('wagtailadmin/shared/main_nav.html', takes_context=True)\ndef main_nav(context):\n    request = context['request']\n\n    return {\n        'menu_html': admin_menu.render_html(request),\n        'request': request,\n    }\n\n@register.simple_tag\ndef main_nav_js():\n    return admin_menu.media['js']\n\n\n@register.filter(\"ellipsistrim\")\ndef ellipsistrim(value, max_length):\n    if len(value) > max_length:\n        truncd_val = value[:max_length]\n        if not len(value) == max_length+1 and value[max_length+1] != \" \":\n            truncd_val = truncd_val[:truncd_val.rfind(\" \")]\n        return truncd_val + \"...\"\n    return value\n\n\n@register.filter\ndef fieldtype(bound_field):\n    try:\n        return camelcase_to_underscore(bound_field.field.__class__.__name__)\n    except AttributeError:\n        try:\n            return camelcase_to_underscore(bound_field.__class__.__name__)\n        except AttributeError:\n            return \"\"\n\n\n@register.filter\ndef widgettype(bound_field):\n    try:\n        return camelcase_to_underscore(bound_field.field.widget.__class__.__name__)\n    except AttributeError:\n        return \"\"\n\n\n@register.filter\ndef meta_description(model):\n    try:\n        return model.model_class()._meta.description\n    except:\n        return \"\"\n\n\n@register.assignment_tag(takes_context=True)\ndef page_permissions(context, page):\n    \"\"\"\n    Usage: {% page_permissions page as page_perms %}\n    Sets the variable 'page_perms' to a PagePermissionTester object that can be queried to find out\n    what actions the current logged-in user can perform on the given page.\n    \"\"\"\n    # Create a UserPagePermissionsProxy object to represent the user's global permissions, and\n    # cache it in the context for the duration of the page request, if one does not exist already\n    if 'user_page_permissions' not in context:\n        context['user_page_permissions'] = UserPagePermissionsProxy(context['request'].user)\n\n    # Now retrieve a PagePermissionTester from it, specific to the given page\n    return context['user_page_permissions'].for_page(page)\n\n\n@register.assignment_tag(takes_context=True)\ndef test_page_is_public(context, page):\n    \"\"\"\n    Usage: {% test_page_is_public page as is_public %}\n    Sets 'is_public' to True iff there are no page view restrictions in place on\n    this page.\n    Caches the list of page view restrictions in the context, to avoid repeated\n    DB queries on repeated calls.\n    \"\"\"\n    if 'all_page_view_restriction_paths' not in context:\n        context['all_page_view_restriction_paths'] = PageViewRestriction.objects.select_related('page').values_list('page__path', flat=True)\n\n    is_private = any([\n        page.path.startswith(restricted_path)\n        for restricted_path in context['all_page_view_restriction_paths']\n    ])\n\n    return not is_private\n\n\n@register.simple_tag\ndef hook_output(hook_name):\n    \"\"\"\n    Example: {% hook_output 'insert_editor_css' %}\n    Whenever we have a hook whose functions take no parameters and return a string, this tag can be used\n    to output the concatenation of all of those return values onto the page.\n    Note that the output is not escaped - it is the hook function's responsibility to escape unsafe content.\n    \"\"\"\n    snippets = [fn() for fn in hooks.get_hooks(hook_name)]\n    return ''.join(snippets)\n\n\n@register.assignment_tag\ndef usage_count_enabled():\n    return getattr(settings, 'WAGTAIL_USAGE_COUNT_ENABLED', False)\n\n\n@register.assignment_tag\ndef base_url_setting():\n    return getattr(settings, 'BASE_URL', None)\n\n\nclass EscapeScriptNode(template.Node):\n    TAG_NAME = 'escapescript'\n    SCRIPT_RE = re.compile(r'<(-*)/script>')\n\n    def __init__(self, nodelist):\n        super(EscapeScriptNode, self).__init__()\n        self.nodelist = nodelist\n\n    def render(self, context):\n        out = self.nodelist.render(context)\n        escaped_out = self.SCRIPT_RE.sub(r'<-\\1/script>', out)\n        return escaped_out\n\n    @classmethod\n    def handle(cls, parser, token):\n        nodelist = parser.parse(('end' + EscapeScriptNode.TAG_NAME,))\n        parser.delete_first_token()\n        return cls(nodelist)\n\nregister.tag(EscapeScriptNode.TAG_NAME, EscapeScriptNode.handle)\n", "path": "wagtail/wagtailadmin/templatetags/wagtailadmin_tags.py"}]}