mirror of
https://github.com/sissbruecker/linkding
synced 2024-11-23 03:43:10 +00:00
14 lines
447 B
Python
14 lines
447 B
Python
|
from django.conf import settings
|
||
|
from django.core import validators
|
||
|
|
||
|
|
||
|
class BookmarkURLValidator(validators.URLValidator):
|
||
|
"""
|
||
|
Extends default Django URLValidator and cancels validation if it is disabled in settings.
|
||
|
This allows to switch URL validation on/off dynamically which helps with testing
|
||
|
"""
|
||
|
def __call__(self, value):
|
||
|
if settings.LD_DISABLE_URL_VALIDATION:
|
||
|
return
|
||
|
|
||
|
super().__call__(value)
|