mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."
This reverts commit 550cb3a365
because try/except performs better.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import json
|
||||
from contextlib import suppress
|
||||
|
||||
from django.core import exceptions, serializers
|
||||
from django.forms import Form
|
||||
@@ -8,10 +7,12 @@ from django.test.utils import modify_settings
|
||||
from . import PostgreSQLTestCase
|
||||
from .models import HStoreModel
|
||||
|
||||
with suppress(ImportError):
|
||||
try:
|
||||
from django.contrib.postgres import forms
|
||||
from django.contrib.postgres.fields import HStoreField
|
||||
from django.contrib.postgres.validators import KeysValidator
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
@modify_settings(INSTALLED_APPS={'append': 'django.contrib.postgres'})
|
||||
|
||||
Reference in New Issue
Block a user