Skip to content

Commit 47b26f3

Browse files
timobrembeckclaudep
authored andcommitted
Remove optimization for internal anchors
1 parent 2525837 commit 47b26f3

File tree

2 files changed

+0
-19
lines changed

2 files changed

+0
-19
lines changed

linkcheck/listeners.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ def do_check_instance_links(sender, instance, wait=False):
9191
for link in links:
9292
# url structure = (field, link text, url)
9393
url = link[2]
94-
internal_hash = False
9594
if url.startswith('#'):
96-
internal_hash = url
9795
url = instance.get_absolute_url() + url
9896

9997
if len(url) > MAX_URL_LENGTH:
@@ -106,9 +104,6 @@ def do_check_instance_links(sender, instance, wait=False):
106104
url=u, field=link[0], text=link[1], content_type=content_type, object_id=instance.pk
107105
)
108106
new_links.append(l.id)
109-
if internal_hash:
110-
setattr(u, '_internal_hash', internal_hash)
111-
setattr(u, '_instance', instance)
112107
u.check_url()
113108

114109
gone_links = old_links.exclude(id__in=new_links)

linkcheck/models.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -291,20 +291,6 @@ def check_internal(self):
291291
self.status = os.path.exists(path) or os.path.exists(decoded_path)
292292
self.message = 'Working file link' if self.status else 'Missing Document'
293293

294-
elif getattr(self, '_internal_hash', False) and getattr(self, '_instance', None):
295-
# This is a hash link pointing to itself
296-
hash = self._internal_hash
297-
instance = self._instance
298-
if hash == '#': # special case, point to #
299-
self.message = 'Working internal hash anchor'
300-
self.status = True
301-
else:
302-
hash = hash[1:] # '#something' => 'something'
303-
html_content = ''
304-
for field in instance._linklist.html_fields:
305-
html_content += getattr(instance, field, '')
306-
self._check_anchor(hash, html_content)
307-
308294
elif self.type == 'internal':
309295
old_prepend_setting = settings.PREPEND_WWW
310296
settings.PREPEND_WWW = False

0 commit comments

Comments
 (0)