Skip to content

Commit ff03105

Browse files
apollo13toastdriven
authored andcommitted
use kwargs.pop instead of try/except
1 parent 2290a51 commit ff03105

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

haystack/forms.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,12 @@ class SearchForm(forms.Form):
1818
q = forms.CharField(required=False, label=_('Search'))
1919

2020
def __init__(self, *args, **kwargs):
21-
self.searchqueryset = kwargs.get('searchqueryset', None)
22-
self.load_all = kwargs.get('load_all', False)
21+
self.searchqueryset = kwargs.pop('searchqueryset', None)
22+
self.load_all = kwargs.pop('load_all', False)
2323

2424
if self.searchqueryset is None:
2525
self.searchqueryset = SearchQuerySet()
2626

27-
try:
28-
del(kwargs['searchqueryset'])
29-
except KeyError:
30-
pass
31-
32-
try:
33-
del(kwargs['load_all'])
34-
except KeyError:
35-
pass
36-
3727
super(SearchForm, self).__init__(*args, **kwargs)
3828

3929
def search(self):

0 commit comments

Comments
 (0)