from django.conf import settings

def generate_secret_delimiter():
    try:
        from hashlib import sha1
    except ImportError:
        from sha import sha as sha1
    return sha1(getattr(settings, 'SECRET_KEY', '')).hexdigest()

LITERAL_DELIMITER = getattr(settings, 'LITERAL_DELIMITER', generate_secret_delimiter())

from django.conf import settings
from django.utils.hashcompat import sha_constructor

def generate_secret_delimiter():
    return sha_constructor(getattr(settings, 'SECRET_KEY', '')).hexdigest()

LITERAL_DELIMITER = getattr(settings, 'LITERAL_DELIMITER', generate_secret_delimiter())

Make use of Django's hashcompat module.
Make use of Django's hashcompat module.
  from django.conf import settings
+ from django.utils.hashcompat import sha_constructor
  
  def generate_secret_delimiter():
-     try:
-         from hashlib import sha1
-     except ImportError:
-         from sha import sha as sha1
-     return sha1(getattr(settings, 'SECRET_KEY', '')).hexdigest()
+     return sha_constructor(getattr(settings, 'SECRET_KEY', '')).hexdigest()
  
  LITERAL_DELIMITER = getattr(settings, 'LITERAL_DELIMITER', generate_secret_delimiter())
  
Make use of Django's hashcompat module.
## Code Before:
from django.conf import settings

def generate_secret_delimiter():
    try:
        from hashlib import sha1
    except ImportError:
        from sha import sha as sha1
    return sha1(getattr(settings, 'SECRET_KEY', '')).hexdigest()

LITERAL_DELIMITER = getattr(settings, 'LITERAL_DELIMITER', generate_secret_delimiter())

## Instruction:
Make use of Django's hashcompat module.
## Code After:
from django.conf import settings
from django.utils.hashcompat import sha_constructor

def generate_secret_delimiter():
    return sha_constructor(getattr(settings, 'SECRET_KEY', '')).hexdigest()

LITERAL_DELIMITER = getattr(settings, 'LITERAL_DELIMITER', generate_secret_delimiter())
