File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed
pylint_django/transforms/transforms Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 27
27
* Update tests and require latest version of pylint (>=1.8), fixes
28
28
[ #53 ] ( https://github.com/landscapeio/pylint-django/issues/53 ) ,
29
29
[ #97 ] ( https://github.com/landscapeio/pylint-django/issues/97 )
30
+ * [ #81 ] ( https://github.com/landscapeio/pylint-django/issues/81 ) Fix 'duplicate-except' false negative
31
+ for except blocks which catch the ` DoesNotExist ` exception.
30
32
31
33
## Version 0.7.4
32
34
* [ #88 ] ( https://github.com/landscapeio/pylint-django/pull/88 ) Fixed builds with Django 1.10 (thanks to [ federicobond] ( https://github.com/federicobond ) )
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ class Model(object):
8
8
pk = None
9
9
10
10
MultipleObjectsReturned = MultipleObjectsReturned
11
- DoesNotExist = ObjectDoesNotExist
12
11
13
12
save = lambda * a , ** kw : None
14
13
delete = lambda * a , ** kw : None
Original file line number Diff line number Diff line change
1
+ """
2
+ Checks that Pylint does not complain about duplicate
3
+ except blocks catching DoesNotExist exceptions:
4
+ https://github.com/landscapeio/pylint-django/issues/81
5
+ """
6
+ # pylint: disable=missing-docstring
7
+ from django .db import models
8
+
9
+
10
+ class Book (models .Model ):
11
+ name = models .CharField (max_length = 100 )
12
+
13
+
14
+ class Author (models .Model ):
15
+ name = models .CharField (max_length = 100 )
16
+
17
+ def dummy_func ():
18
+ try :
19
+ print ("foo" )
20
+ except Book .DoesNotExist :
21
+ print ("bar" )
22
+ except Author .DoesNotExist :
23
+ print ("baz" )
You can’t perform that action at this time.
0 commit comments