@@ -66,16 +66,16 @@ args = parser.parse_args()
6666# Import Django, call setup()
6767os .environ .setdefault ("DJANGO_SETTINGS_MODULE" , args .settings or "ietf.settings_testcrawl" )
6868
69- # import django
70- # import django.test
71- # import django.core.checks
72- # from django.conf import settings
73- # from django.utils import timezone
74- #
75- # django.setup()
69+ import django
70+ import django .test
71+ import django .core .checks
72+ from django .conf import settings
73+ from django .utils import timezone
74+
75+ django .setup ()
7676
7777# This needs to come after we set up sys path to include the local django
78- # import debug # pyflakes:ignore
78+ import debug # pyflakes:ignore
7979
8080# prevent memory from leaking when settings.DEBUG=True
8181# from django.db import connection
@@ -84,7 +84,7 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", args.settings or "ietf.settings_
8484# pass
8585# connection.queries = DontSaveQueries()
8686
87- # from ietf.name.models import DocTypeName
87+ from ietf .name .models import DocTypeName
8888from ietf .utils .html import unescape
8989from ietf .utils .test_utils import unicontent
9090from ietf .utils .test_runner import start_vnu_server , vnu_validate , vnu_fmt_message , vnu_filter_message
@@ -257,7 +257,7 @@ def nowstr():
257257 t = time .time_ns ()/ (10 ** 9 )
258258 if nowtime != t :
259259 nowtime = t
260- nowstrn = datetime . datetime . now (tz = datetime . timezone . utc ).strftime ('%H:%M:%S' ).encode ()
260+ nowstrn = timezone . now ().strftime ('%H:%M:%S' ).encode ()
261261 return nowstrn
262262
263263b_exthost = re .sub (b'https?' , b'' , args .exthost .encode ()) if args .exthost else None
@@ -408,45 +408,15 @@ parser = html5lib.HTMLParser(strict=True)
408408# because they aren't under our control, such as uploaded group agendas.
409409validated_urls = {'/meeting/nn/agenda/foo/' : True , }
410410
411- # doc_types = [ t.slug for t in DocTypeName.objects.all() ]
412- doc_types = ["agenda" , "bcp" , "bluesheets" , "bofreq" , "charter" , "draft" , "rfc" ] # partial list
411+ doc_types = [ t .slug for t in DocTypeName .objects .all () ]
413412
414413errors = 0
415414warnings = 0
416415count = 0
417416
418417start_time = datetime .datetime .now ()
419418
420- # client = django.test.Client(Accept='text/html,text/plain,application/json')
421- class ExtResponse :
422- charset = "utf8"
423- def __init__ (self , requests_response ):
424- self ._requests_response = requests_response
425-
426- def __getattr__ (self , item ):
427- return getattr (self ._requests_response , item )
428-
429- def __getitem__ (self , item ):
430- return self ._requests_response .headers [item ]
431-
432-
433- class ExtClient :
434- base_url = "http://localhost"
435- accept_header = "text/html,text/plain,application/json"
436-
437- def get (self , url , ** kwargs ):
438- kwargs .pop ("secure" , None )
439- headers = kwargs .setdefault ("headers" , {})
440- headers ["accept" ] = self .accept_header
441- return ExtResponse (
442- requests .get (
443- urllib .parse .urljoin (self .base_url , url ),
444- ** kwargs ,
445- )
446- )
447-
448-
449- client = ExtClient ()
419+ client = django .test .Client (Accept = 'text/html,text/plain,application/json' )
450420
451421logfile = None
452422if args .logfile :
@@ -480,8 +450,7 @@ if __name__ == "__main__":
480450 do_exit (1 )
481451
482452 # Run django system checks and checks from ietf.checks:
483- # error_list = django.core.checks.run_checks()
484- error_list = []
453+ error_list = django .core .checks .run_checks ()
485454 silenced = []
486455 for i in range (len (error_list )):
487456 if error_list [i ].id in settings .SILENCED_SYSTEM_CHECKS :
0 commit comments