Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #20841 -- Added messages to NotImplementedErrors

Thanks joseph at vertstudios.com for the suggestion.
  • Loading branch information...
commit b2b763448f726ee952743596e9a34fcb154bdb12 1 parent d59f199
Cheekio authored September 06, 2013 timgraham committed September 10, 2013
12  django/contrib/admin/filters.py
@@ -33,26 +33,26 @@ def has_output(self):
33 33
         """
34 34
         Returns True if some choices would be output for this filter.
35 35
         """
36  
-        raise NotImplementedError
  36
+        raise NotImplementedError('subclasses of ListFilter must provide a has_output() method')
37 37
 
38 38
     def choices(self, cl):
39 39
         """
40 40
         Returns choices ready to be output in the template.
41 41
         """
42  
-        raise NotImplementedError
  42
+        raise NotImplementedError('subclasses of ListFilter must provide a choices() method')
43 43
 
44 44
     def queryset(self, request, queryset):
45 45
         """
46 46
         Returns the filtered queryset.
47 47
         """
48  
-        raise NotImplementedError
  48
+        raise NotImplementedError('subclasses of ListFilter must provide a queryset() method')
49 49
 
50 50
     def expected_parameters(self):
51 51
         """
52 52
         Returns the list of parameter names that are expected from the
53 53
         request's query string and that will be used by this filter.
54 54
         """
55  
-        raise NotImplementedError
  55
+        raise NotImplementedError('subclasses of ListFilter must provide an expected_parameters() method')
56 56
 
57 57
 
58 58
 class SimpleListFilter(ListFilter):
@@ -89,7 +89,9 @@ def lookups(self, request, model_admin):
89 89
         """
90 90
         Must be overridden to return a list of tuples (value, verbose value)
91 91
         """
92  
-        raise NotImplementedError
  92
+        raise NotImplementedError(
  93
+            'The SimpleListFilter.lookups() method must be overridden to '
  94
+            'return a list of tuples (value, verbose value)')
93 95
 
94 96
     def expected_parameters(self):
95 97
         return [self.parameter_name]
6  django/contrib/auth/hashers.py
@@ -192,7 +192,7 @@ def verify(self, password, encoded):
192 192
         """
193 193
         Checks if the given password is correct
194 194
         """
195  
-        raise NotImplementedError()
  195
+        raise NotImplementedError('subclasses of BasePasswordHasher must provide a verify() method')
196 196
 
197 197
     def encode(self, password, salt):
198 198
         """
@@ -201,7 +201,7 @@ def encode(self, password, salt):
201 201
         The result is normally formatted as "algorithm$salt$hash" and
202 202
         must be fewer than 128 characters.
203 203
         """
204  
-        raise NotImplementedError()
  204
+        raise NotImplementedError('subclasses of BasePasswordHasher must provide an encode() method')
205 205
 
206 206
     def safe_summary(self, encoded):
207 207
         """
@@ -210,7 +210,7 @@ def safe_summary(self, encoded):
210 210
         The result is a dictionary and will be used where the password field
211 211
         must be displayed to construct a safe representation of the password.
212 212
         """
213  
-        raise NotImplementedError()
  213
+        raise NotImplementedError('subclasses of BasePasswordHasher must provide a safe_summary() method')
214 214
 
215 215
 
216 216
 class PBKDF2PasswordHasher(BasePasswordHasher):
12  django/contrib/auth/models.py
@@ -245,10 +245,10 @@ def has_usable_password(self):
245 245
         return is_password_usable(self.password)
246 246
 
247 247
     def get_full_name(self):
248  
-        raise NotImplementedError()
  248
+        raise NotImplementedError('subclasses of AbstractBaseUser must provide a get_full_name() method')
249 249
 
250 250
     def get_short_name(self):
251  
-        raise NotImplementedError()
  251
+        raise NotImplementedError('subclasses of AbstractBaseUser must provide a get_short_name() method.')
252 252
 
253 253
 
254 254
 # A few helper functions for common logic between User and AnonymousUser.
@@ -441,16 +441,16 @@ def __hash__(self):
441 441
         return 1  # instances always return the same hash value
442 442
 
443 443
     def save(self):
444  
-        raise NotImplementedError
  444
+        raise NotImplementedError("Django doesn't provide a DB representation for AnonymousUser.")
445 445
 
446 446
     def delete(self):
447  
-        raise NotImplementedError
  447
+        raise NotImplementedError("Django doesn't provide a DB representation for AnonymousUser.")
448 448
 
449 449
     def set_password(self, raw_password):
450  
-        raise NotImplementedError
  450
+        raise NotImplementedError("Django doesn't provide a DB representation for AnonymousUser.")
451 451
 
452 452
     def check_password(self, raw_password):
453  
-        raise NotImplementedError
  453
+        raise NotImplementedError("Django doesn't provide a DB representation for AnonymousUser.")
454 454
 
455 455
     def _get_groups(self):
456 456
         return self._groups
3  django/contrib/comments/templatetags/comments.py
@@ -112,7 +112,7 @@ def get_target_ctype_pk(self, context):
112 112
 
113 113
     def get_context_value_from_queryset(self, context, qs):
114 114
         """Subclasses should override this."""
115  
-        raise NotImplementedError
  115
+        raise NotImplementedError('subclasses of BaseCommentNode must provide a get_context_value_from_queryset() method')
116 116
 
117 117
 class CommentListNode(BaseCommentNode):
118 118
     """Insert a list of comments into the context."""
@@ -338,4 +338,3 @@ def get_comment_permalink(comment, anchor_pattern=None):
338 338
     if anchor_pattern:
339 339
         return comment.get_absolute_url(anchor_pattern)
340 340
     return comment.get_absolute_url()
341  
-
10  django/contrib/gis/db/backends/base.py
@@ -101,7 +101,7 @@ def geo_db_type(self, f):
101 101
         Returns the database column type for the geometry field on
102 102
         the spatial backend.
103 103
         """
104  
-        raise NotImplementedError
  104
+        raise NotImplementedError('subclasses of BaseSpatialOperations must provide a geo_db_type() method')
105 105
 
106 106
     def get_distance(self, f, value, lookup_type):
107 107
         """
@@ -117,7 +117,7 @@ def get_geom_placeholder(self, f, value):
117 117
         stored procedure call to the transformation function of the spatial
118 118
         backend.
119 119
         """
120  
-        raise NotImplementedError
  120
+        raise NotImplementedError('subclasses of BaseSpatialOperations must provide a geo_db_placeholder() method')
121 121
 
122 122
     def get_expression_column(self, evaluator):
123 123
         """
@@ -134,14 +134,14 @@ def spatial_aggregate_sql(self, agg):
134 134
         raise NotImplementedError('Aggregate support not implemented for this spatial backend.')
135 135
 
136 136
     def spatial_lookup_sql(self, lvalue, lookup_type, value, field):
137  
-        raise NotImplementedError
  137
+        raise NotImplementedError('subclasses of BaseSpatialOperations must a provide spatial_lookup_sql() method')
138 138
 
139 139
     # Routines for getting the OGC-compliant models.
140 140
     def geometry_columns(self):
141  
-        raise NotImplementedError
  141
+        raise NotImplementedError('subclasses of BaseSpatialOperations must a provide geometry_columns() method')
142 142
 
143 143
     def spatial_ref_sys(self):
144  
-        raise NotImplementedError
  144
+        raise NotImplementedError('subclasses of BaseSpatialOperations must a provide spatial_ref_sys() method')
145 145
 
146 146
 @python_2_unicode_compatible
147 147
 class SpatialRefSysMixin(object):
4  django/contrib/messages/storage/base.py
@@ -105,7 +105,7 @@ def _get(self, *args, **kwargs):
105 105
         just containing no messages) then ``None`` should be returned in
106 106
         place of ``messages``.
107 107
         """
108  
-        raise NotImplementedError()
  108
+        raise NotImplementedError('subclasses of BaseStorage must provide a _get() method')
109 109
 
110 110
     def _store(self, messages, response, *args, **kwargs):
111 111
         """
@@ -116,7 +116,7 @@ def _store(self, messages, response, *args, **kwargs):
116 116
 
117 117
         **This method must be implemented by a subclass.**
118 118
         """
119  
-        raise NotImplementedError()
  119
+        raise NotImplementedError('subclasses of BaseStorage must provide a _store() method')
120 120
 
121 121
     def _prepare_messages(self, messages):
122 122
         """
12  django/contrib/sessions/backends/base.py
@@ -284,7 +284,7 @@ def exists(self, session_key):
284 284
         """
285 285
         Returns True if the given session_key already exists.
286 286
         """
287  
-        raise NotImplementedError
  287
+        raise NotImplementedError('subclasses of SessionBase must provide an exists() method')
288 288
 
289 289
     def create(self):
290 290
         """
@@ -292,7 +292,7 @@ def create(self):
292 292
         a unique key and will have saved the result once (with empty data)
293 293
         before the method returns.
294 294
         """
295  
-        raise NotImplementedError
  295
+        raise NotImplementedError('subclasses of SessionBase must provide a create() method')
296 296
 
297 297
     def save(self, must_create=False):
298 298
         """
@@ -300,20 +300,20 @@ def save(self, must_create=False):
300 300
         is created (otherwise a CreateError exception is raised). Otherwise,
301 301
         save() can update an existing object with the same key.
302 302
         """
303  
-        raise NotImplementedError
  303
+        raise NotImplementedError('subclasses of SessionBase must provide a save() method')
304 304
 
305 305
     def delete(self, session_key=None):
306 306
         """
307 307
         Deletes the session data under this key. If the key is None, the
308 308
         current session key value is used.
309 309
         """
310  
-        raise NotImplementedError
  310
+        raise NotImplementedError('subclasses of SessionBase must provide a delete() method')
311 311
 
312 312
     def load(self):
313 313
         """
314 314
         Loads the session data and returns a dictionary.
315 315
         """
316  
-        raise NotImplementedError
  316
+        raise NotImplementedError('subclasses of SessionBase must provide a load() method')
317 317
 
318 318
     @classmethod
319 319
     def clear_expired(cls):
@@ -324,4 +324,4 @@ def clear_expired(cls):
324 324
         NotImplementedError. If it isn't necessary, because the backend has
325 325
         a built-in expiration mechanism, it should be a no-op.
326 326
         """
327  
-        raise NotImplementedError
  327
+        raise NotImplementedError('This backend does not support clear_expired().')
4  django/contrib/staticfiles/finders.py
@@ -28,7 +28,7 @@ def find(self, path, all=False):
28 28
         the first found file path will be returned; if set
29 29
         to ``True`` a list of all found files paths is returned.
30 30
         """
31  
-        raise NotImplementedError()
  31
+        raise NotImplementedError('subclasses of BaseFinder must provide a find() method')
32 32
 
33 33
     def list(self, ignore_patterns):
34 34
         """
@@ -36,7 +36,7 @@ def list(self, ignore_patterns):
36 36
         a two item iterable consisting of the relative path and storage
37 37
         instance.
38 38
         """
39  
-        raise NotImplementedError()
  39
+        raise NotImplementedError('subclasses of BaseFinder must provide a list() method')
40 40
 
41 41
 
42 42
 class FileSystemFinder(BaseFinder):
10  django/core/cache/backends/base.py
@@ -96,27 +96,27 @@ def add(self, key, value, timeout=DEFAULT_TIMEOUT, version=None):
96 96
 
97 97
         Returns True if the value was stored, False otherwise.
98 98
         """
99  
-        raise NotImplementedError
  99
+        raise NotImplementedError('subclasses of BaseCache must provide an add() method')
100 100
 
101 101
     def get(self, key, default=None, version=None):
102 102
         """
103 103
         Fetch a given key from the cache. If the key does not exist, return
104 104
         default, which itself defaults to None.
105 105
         """
106  
-        raise NotImplementedError
  106
+        raise NotImplementedError('subclasses of BaseCache must provide a get() method')
107 107
 
108 108
     def set(self, key, value, timeout=DEFAULT_TIMEOUT, version=None):
109 109
         """
110 110
         Set a value in the cache. If timeout is given, that timeout will be
111 111
         used for the key; otherwise the default cache timeout will be used.
112 112
         """
113  
-        raise NotImplementedError
  113
+        raise NotImplementedError('subclasses of BaseCache must provide a set() method')
114 114
 
115 115
     def delete(self, key, version=None):
116 116
         """
117 117
         Delete a key from the cache, failing silently.
118 118
         """
119  
-        raise NotImplementedError
  119
+        raise NotImplementedError('subclasses of BaseCache must provide a delete() method')
120 120
 
121 121
     def get_many(self, keys, version=None):
122 122
         """
@@ -190,7 +190,7 @@ def delete_many(self, keys, version=None):
190 190
 
191 191
     def clear(self):
192 192
         """Remove *all* values from the cache at once."""
193  
-        raise NotImplementedError
  193
+        raise NotImplementedError('subclasses of BaseCache must provide a clear() method')
194 194
 
195 195
     def validate_key(self, key):
196 196
         """
16  django/core/files/storage.py
@@ -92,55 +92,55 @@ def delete(self, name):
92 92
         """
93 93
         Deletes the specified file from the storage system.
94 94
         """
95  
-        raise NotImplementedError()
  95
+        raise NotImplementedError('subclasses of Storage must provide a delete() method')
96 96
 
97 97
     def exists(self, name):
98 98
         """
99 99
         Returns True if a file referened by the given name already exists in the
100 100
         storage system, or False if the name is available for a new file.
101 101
         """
102  
-        raise NotImplementedError()
  102
+        raise NotImplementedError('subclasses of Storage must provide a exists() method')
103 103
 
104 104
     def listdir(self, path):
105 105
         """
106 106
         Lists the contents of the specified path, returning a 2-tuple of lists;
107 107
         the first item being directories, the second item being files.
108 108
         """
109  
-        raise NotImplementedError()
  109
+        raise NotImplementedError('subclasses of Storage must provide a listdir() method')
110 110
 
111 111
     def size(self, name):
112 112
         """
113 113
         Returns the total size, in bytes, of the file specified by name.
114 114
         """
115  
-        raise NotImplementedError()
  115
+        raise NotImplementedError('subclasses of Storage must provide a size() method')
116 116
 
117 117
     def url(self, name):
118 118
         """
119 119
         Returns an absolute URL where the file's contents can be accessed
120 120
         directly by a Web browser.
121 121
         """
122  
-        raise NotImplementedError()
  122
+        raise NotImplementedError('subclasses of Storage must provide a url() method')
123 123
 
124 124
     def accessed_time(self, name):
125 125
         """
126 126
         Returns the last accessed time (as datetime object) of the file
127 127
         specified by name.
128 128
         """
129  
-        raise NotImplementedError()
  129
+        raise NotImplementedError('subclasses of Storage must provide an accessed_time() method')
130 130
 
131 131
     def created_time(self, name):
132 132
         """
133 133
         Returns the creation time (as datetime object) of the file
134 134
         specified by name.
135 135
         """
136  
-        raise NotImplementedError()
  136
+        raise NotImplementedError('subclasses of Storage must provide a created_time() method')
137 137
 
138 138
     def modified_time(self, name):
139 139
         """
140 140
         Returns the last modified time (as datetime object) of the file
141 141
         specified by name.
142 142
         """
143  
-        raise NotImplementedError()
  143
+        raise NotImplementedError('subclasses of Storage must provide a modified_time() method')
144 144
 
145 145
 class FileSystemStorage(Storage):
146 146
     """
4  django/core/files/uploadhandler.py
@@ -104,7 +104,7 @@ def receive_data_chunk(self, raw_data, start):
104 104
         Receive data from the streamed upload parser. ``start`` is the position
105 105
         in the file of the chunk.
106 106
         """
107  
-        raise NotImplementedError()
  107
+        raise NotImplementedError('subclasses of FileUploadHandler must provide a recieve_data_chunk() method')
108 108
 
109 109
     def file_complete(self, file_size):
110 110
         """
@@ -113,7 +113,7 @@ def file_complete(self, file_size):
113 113
 
114 114
         Subclasses should return a valid ``UploadedFile`` object.
115 115
         """
116  
-        raise NotImplementedError()
  116
+        raise NotImplementedError('subclasses of FileUploadHandler must provide a file_complete() method')
117 117
 
118 118
     def upload_complete(self):
119 119
         """
2  django/core/mail/backends/base.py
@@ -36,4 +36,4 @@ def send_messages(self, email_messages):
36 36
         Sends one or more EmailMessage objects and returns the number of email
37 37
         messages sent.
38 38
         """
39  
-        raise NotImplementedError
  39
+        raise NotImplementedError('subclasses of BaseEmailBackend must override send_messages() method')
8  django/core/management/base.py
@@ -325,7 +325,7 @@ def handle(self, *args, **options):
325 325
         this method.
326 326
 
327 327
         """
328  
-        raise NotImplementedError()
  328
+        raise NotImplementedError('subclasses of BaseCommand must provide a handle() method')
329 329
 
330 330
 
331 331
 class AppCommand(BaseCommand):
@@ -361,7 +361,7 @@ def handle_app(self, app, **options):
361 361
         the command line.
362 362
 
363 363
         """
364  
-        raise NotImplementedError()
  364
+        raise NotImplementedError('subclasses of AppCommand must provide a handle_app() method')
365 365
 
366 366
 
367 367
 class LabelCommand(BaseCommand):
@@ -397,7 +397,7 @@ def handle_label(self, label, **options):
397 397
         string as given on the command line.
398 398
 
399 399
         """
400  
-        raise NotImplementedError()
  400
+        raise NotImplementedError('subclasses of LabelCommand must provide a handle_label() method')
401 401
 
402 402
 
403 403
 class NoArgsCommand(BaseCommand):
@@ -423,4 +423,4 @@ def handle_noargs(self, **options):
423 423
         Perform this command's actions.
424 424
 
425 425
         """
426  
-        raise NotImplementedError()
  426
+        raise NotImplementedError('subclasses of NoArgsCommand must provide a handle_noargs() method')
12  django/core/serializers/base.py
@@ -65,7 +65,7 @@ def start_serialization(self):
65 65
         """
66 66
         Called when serializing of the queryset starts.
67 67
         """
68  
-        raise NotImplementedError
  68
+        raise NotImplementedError('subclasses of Serializer must provide a start_serialization() method')
69 69
 
70 70
     def end_serialization(self):
71 71
         """
@@ -77,7 +77,7 @@ def start_object(self, obj):
77 77
         """
78 78
         Called when serializing of an object starts.
79 79
         """
80  
-        raise NotImplementedError
  80
+        raise NotImplementedError('subclasses of Serializer must provide a start_object() method')
81 81
 
82 82
     def end_object(self, obj):
83 83
         """
@@ -89,19 +89,19 @@ def handle_field(self, obj, field):
89 89
         """
90 90
         Called to handle each individual (non-relational) field on an object.
91 91
         """
92  
-        raise NotImplementedError
  92
+        raise NotImplementedError('subclasses of Serializer must provide an handle_field() method')
93 93
 
94 94
     def handle_fk_field(self, obj, field):
95 95
         """
96 96
         Called to handle a ForeignKey field.
97 97
         """
98  
-        raise NotImplementedError
  98
+        raise NotImplementedError('subclasses of Serializer must provide an handle_fk_field() method')
99 99
 
100 100
     def handle_m2m_field(self, obj, field):
101 101
         """
102 102
         Called to handle a ManyToManyField.
103 103
         """
104  
-        raise NotImplementedError
  104
+        raise NotImplementedError('subclasses of Serializer must provide an handle_m2m_field() method')
105 105
 
106 106
     def getvalue(self):
107 107
         """
@@ -135,7 +135,7 @@ def __iter__(self):
135 135
 
136 136
     def __next__(self):
137 137
         """Iteration iterface -- return the next item in the stream"""
138  
-        raise NotImplementedError
  138
+        raise NotImplementedError('subclasses of Deserializer must provide a __next__() method')
139 139
 
140 140
 class DeserializedObject(object):
141 141
     """
44  django/db/backends/__init__.py
@@ -84,19 +84,19 @@ def __hash__(self):
84 84
 
85 85
     def get_connection_params(self):
86 86
         """Returns a dict of parameters suitable for get_new_connection."""
87  
-        raise NotImplementedError
  87
+        raise NotImplementedError('subclasses of BaseDatabaseWrapper may require a get_connection_params() method')
88 88
 
89 89
     def get_new_connection(self, conn_params):
90 90
         """Opens a connection to the database."""
91  
-        raise NotImplementedError
  91
+        raise NotImplementedError('subclasses of BaseDatabaseWrapper may require a get_new_connection() method')
92 92
 
93 93
     def init_connection_state(self):
94 94
         """Initializes the database connection settings."""
95  
-        raise NotImplementedError
  95
+        raise NotImplementedError('subclasses of BaseDatabaseWrapper may require an init_connection_state() method')
96 96
 
97 97
     def create_cursor(self):
98 98
         """Creates a cursor. Assumes that a connection is established."""
99  
-        raise NotImplementedError
  99
+        raise NotImplementedError('subclasses of BaseDatabaseWrapper may require a create_cursor() method')
100 100
 
101 101
     ##### Backend-specific methods for creating connections #####
102 102
 
@@ -262,7 +262,7 @@ def _set_autocommit(self, autocommit):
262 262
         """
263 263
         Backend-specific implementation to enable or disable autocommit.
264 264
         """
265  
-        raise NotImplementedError
  265
+        raise NotImplementedError('subclasses of BaseDatabaseWrapper may require a _set_autocommit() method')
266 266
 
267 267
     ##### Generic transaction management methods #####
268 268
 
@@ -440,7 +440,7 @@ def is_usable(self):
440 440
         Tests if the database connection is usable.
441 441
         This function may assume that self.connection is not None.
442 442
         """
443  
-        raise NotImplementedError
  443
+        raise NotImplementedError('subclasses of BaseDatabaseWrapper may require an is_usable() method')
444 444
 
445 445
     def close_if_unusable_or_obsolete(self):
446 446
         """
@@ -519,11 +519,11 @@ def _start_transaction_under_autocommit(self):
519 519
         """
520 520
         Only required when autocommits_when_autocommit_is_off = True.
521 521
         """
522  
-        raise NotImplementedError
  522
+        raise NotImplementedError('subclasses of BaseDatabaseWrapper may require a _start_transaction_under_autocommit() method')
523 523
 
524 524
     def schema_editor(self, *args, **kwargs):
525 525
         "Returns a new instance of this backend's SchemaEditor"
526  
-        raise NotImplementedError()
  526
+        raise NotImplementedError('subclasses of BaseDatabaseWrapper may require a schema_editor() method')
527 527
 
528 528
 
529 529
 class BaseDatabaseFeatures(object):
@@ -741,13 +741,13 @@ def date_extract_sql(self, lookup_type, field_name):
741 741
         Given a lookup_type of 'year', 'month' or 'day', returns the SQL that
742 742
         extracts a value from the given date field field_name.
743 743
         """
744  
-        raise NotImplementedError()
  744
+        raise NotImplementedError('subclasses of BaseDatabaseOperations may require a date_extract_sql() method')
745 745
 
746 746
     def date_interval_sql(self, sql, connector, timedelta):
747 747
         """
748 748
         Implements the date interval functionality for expressions
749 749
         """
750  
-        raise NotImplementedError()
  750
+        raise NotImplementedError('subclasses of BaseDatabaseOperations may require a date_interval_sql() method')
751 751
 
752 752
     def date_trunc_sql(self, lookup_type, field_name):
753 753
         """
@@ -755,7 +755,7 @@ def date_trunc_sql(self, lookup_type, field_name):
755 755
         truncates the given date field field_name to a date object with only
756 756
         the given specificity.
757 757
         """
758  
-        raise NotImplementedError()
  758
+        raise NotImplementedError('subclasses of BaseDatabaseOperations may require a datetrunc_sql() method')
759 759
 
760 760
     def datetime_cast_sql(self):
761 761
         """
@@ -772,7 +772,7 @@ def datetime_extract_sql(self, lookup_type, field_name, tzname):
772 772
         'second', returns the SQL that extracts a value from the given
773 773
         datetime field field_name, and a tuple of parameters.
774 774
         """
775  
-        raise NotImplementedError()
  775
+        raise NotImplementedError('subclasses of BaseDatabaseOperations may require a datetime_extract_sql() method')
776 776
 
777 777
     def datetime_trunc_sql(self, lookup_type, field_name, tzname):
778 778
         """
@@ -781,7 +781,7 @@ def datetime_trunc_sql(self, lookup_type, field_name, tzname):
781 781
         field_name to a datetime object with only the given specificity, and
782 782
         a tuple of parameters.
783 783
         """
784  
-        raise NotImplementedError()
  784
+        raise NotImplementedError('subclasses of BaseDatabaseOperations may require a datetime_trunk_sql() method')
785 785
 
786 786
     def deferrable_sql(self):
787 787
         """
@@ -916,7 +916,7 @@ def no_limit_value(self):
916 916
         Returns the value to use for the LIMIT when we are wanting "LIMIT
917 917
         infinity". Returns None if the limit clause can be omitted in this case.
918 918
         """
919  
-        raise NotImplementedError
  919
+        raise NotImplementedError('subclasses of BaseDatabaseOperations may require a no_limit_value() method')
920 920
 
921 921
     def pk_default_value(self):
922 922
         """
@@ -956,7 +956,7 @@ def quote_name(self, name):
956 956
         Returns a quoted version of the given table, index or column name. Does
957 957
         not quote the given name if it's already been quoted.
958 958
         """
959  
-        raise NotImplementedError()
  959
+        raise NotImplementedError('subclasses of BaseDatabaseOperations may require a quote_name() method')
960 960
 
961 961
     def quote_parameter(self, value):
962 962
         """
@@ -982,7 +982,7 @@ def regex_lookup(self, lookup_type):
982 982
         If the feature is not supported (or part of it is not supported), a
983 983
         NotImplementedError exception can be raised.
984 984
         """
985  
-        raise NotImplementedError
  985
+        raise NotImplementedError('subclasses of BaseDatabaseOperations may require a regex_lookup() method')
986 986
 
987 987
     def savepoint_create_sql(self, sid):
988 988
         """
@@ -1028,7 +1028,7 @@ def sql_flush(self, style, tables, sequences, allow_cascade=False):
1028 1028
         to tables with foreign keys pointing the tables being truncated.
1029 1029
         PostgreSQL requires a cascade even if these tables are empty.
1030 1030
         """
1031  
-        raise NotImplementedError()
  1031
+        raise NotImplementedError('subclasses of BaseDatabaseOperations must provide a sql_flush() method')
1032 1032
 
1033 1033
     def sequence_reset_by_name_sql(self, style, sequences):
1034 1034
         """
@@ -1245,7 +1245,7 @@ def get_table_list(self, cursor):
1245 1245
         Returns an unsorted list of names of all tables that exist in the
1246 1246
         database.
1247 1247
         """
1248  
-        raise NotImplementedError
  1248
+        raise NotImplementedError('subclasses of BaseDatabaseIntrospection may require a get_table_list() method')
1249 1249
 
1250 1250
     def django_table_names(self, only_existing=False):
1251 1251
         """
@@ -1322,7 +1322,7 @@ def get_key_columns(self, cursor, table_name):
1322 1322
         Backends can override this to return a list of (column_name, referenced_table_name,
1323 1323
         referenced_column_name) for all key columns in given table.
1324 1324
         """
1325  
-        raise NotImplementedError
  1325
+        raise NotImplementedError('subclasses of BaseDatabaseIntrospection may require a get_key_columns() method')
1326 1326
 
1327 1327
     def get_primary_key_column(self, cursor, table_name):
1328 1328
         """
@@ -1342,7 +1342,7 @@ def get_indexes(self, cursor, table_name):
1342 1342
 
1343 1343
         Only single-column indexes are introspected.
1344 1344
         """
1345  
-        raise NotImplementedError
  1345
+        raise NotImplementedError('subclasses of BaseDatabaseIntrospection may require a get_indexes() method')
1346 1346
 
1347 1347
     def get_constraints(self, cursor, table_name):
1348 1348
         """
@@ -1361,7 +1361,7 @@ def get_constraints(self, cursor, table_name):
1361 1361
         Some backends may return special constraint names that don't exist
1362 1362
         if they don't name constraints of a certain type (e.g. SQLite)
1363 1363
         """
1364  
-        raise NotImplementedError
  1364
+        raise NotImplementedError('subclasses of BaseDatabaseIntrospection may require a get_constraints() method')
1365 1365
 
1366 1366
 
1367 1367
 class BaseDatabaseClient(object):
@@ -1378,7 +1378,7 @@ def __init__(self, connection):
1378 1378
         self.connection = connection
1379 1379
 
1380 1380
     def runshell(self):
1381  
-        raise NotImplementedError()
  1381
+        raise NotImplementedError('subclasses of BaseDatabaseClient must provide a runshell() method')
1382 1382
 
1383 1383
 
1384 1384
 class BaseDatabaseValidation(object):
2  django/db/backends/schema.py
@@ -148,7 +148,7 @@ def prepare_default(self, value):
148 148
         """
149 149
         Only used for backends which have requires_literal_defaults feature
150 150
         """
151  
-        raise NotImplementedError()
  151
+        raise NotImplementedError('subclasses of BaseDatabaseSchemaEditor for backends which have requires_literal_defaults must provide a prepare_default() method')
152 152
 
153 153
     def effective_default(self, field):
154 154
         """
6  django/db/migrations/operations/base.py
@@ -38,14 +38,14 @@ def state_forwards(self, app_label, state):
38 38
         Takes the state from the previous migration, and mutates it
39 39
         so that it matches what this migration would perform.
40 40
         """
41  
-        raise NotImplementedError()
  41
+        raise NotImplementedError('subclasses of Operation must provide a state_forwards() method')
42 42
 
43 43
     def database_forwards(self, app_label, schema_editor, from_state, to_state):
44 44
         """
45 45
         Performs the mutation on the database schema in the normal
46 46
         (forwards) direction.
47 47
         """
48  
-        raise NotImplementedError()
  48
+        raise NotImplementedError('subclasses of Operation must provide a database_forwards() method')
49 49
 
50 50
     def database_backwards(self, app_label, schema_editor, from_state, to_state):
51 51
         """
@@ -53,7 +53,7 @@ def database_backwards(self, app_label, schema_editor, from_state, to_state):
53 53
         direction - e.g. if this were CreateModel, it would in fact
54 54
         drop the model's table.
55 55
         """
56  
-        raise NotImplementedError()
  56
+        raise NotImplementedError('subclasses of Operation must provide a database_backwards() method')
57 57
 
58 58
     def describe(self):
59 59
         """
2  django/forms/widgets.py
@@ -190,7 +190,7 @@ def render(self, name, value, attrs=None):
190 190
         The 'value' given is not guaranteed to be valid input, so subclass
191 191
         implementations should program defensively.
192 192
         """
193  
-        raise NotImplementedError
  193
+        raise NotImplementedError('subclasses of Widget must provide a render() method')
194 194
 
195 195
     def build_attrs(self, extra_attrs=None, **kwargs):
196 196
         "Helper function for building an attribute dictionary."
4  django/template/base.py
@@ -99,7 +99,7 @@ def __init__(self, name):
99 99
         self.name = name
100 100
 
101 101
     def reload(self):
102  
-        raise NotImplementedError
  102
+        raise NotImplementedError('subclasses of Origin must provide a reload() method')
103 103
 
104 104
     def __str__(self):
105 105
         return self.name
@@ -385,7 +385,7 @@ def top(self):
385 385
         """
386 386
         Overload this method to do the actual parsing and return the result.
387 387
         """
388  
-        raise NotImplementedError()
  388
+        raise NotImplementedError('subclasses of Tokenparser must provide a top() method')
389 389
 
390 390
     def more(self):
391 391
         """
2  django/template/loader.py
@@ -61,7 +61,7 @@ def load_template_source(self, template_name, template_dirs=None):
61 61
         name.
62 62
 
63 63
         """
64  
-        raise NotImplementedError
  64
+        raise NotImplementedError('subclasses of BaseLoader must provide a load_template_source() method')
65 65
 
66 66
     def reset(self):
67 67
         """
4  django/utils/archive.py
@@ -126,10 +126,10 @@ def has_leading_dir(self, paths):
126 126
         return True
127 127
 
128 128
     def extract(self):
129  
-        raise NotImplementedError
  129
+        raise NotImplementedError('subclasses of BaseArchive must provide an extract() method')
130 130
 
131 131
     def list(self):
132  
-        raise NotImplementedError
  132
+        raise NotImplementedError('subclasses of BaseArchive must provide a list() method')
133 133
 
134 134
 
135 135
 class TarArchive(BaseArchive):
2  django/utils/dateformat.py
@@ -65,7 +65,7 @@ def A(self):
65 65
 
66 66
     def B(self):
67 67
         "Swatch Internet time"
68  
-        raise NotImplementedError
  68
+        raise NotImplementedError('may be implemented in a future release')
69 69
 
70 70
     def e(self):
71 71
         """
2  django/utils/feedgenerator.py
@@ -177,7 +177,7 @@ def write(self, outfile, encoding):
177 177
         Outputs the feed in the given encoding to outfile, which is a file-like
178 178
         object. Subclasses should override this.
179 179
         """
180  
-        raise NotImplementedError
  180
+        raise NotImplementedError('subclasses of SyndicationFeed must provide a write() method')
181 181
 
182 182
     def writeString(self, encoding):
183 183
         """
2  django/utils/functional.py
@@ -257,7 +257,7 @@ def _setup(self):
257 257
         """
258 258
         Must be implemented by subclasses to initialise the wrapped object.
259 259
         """
260  
-        raise NotImplementedError
  260
+        raise NotImplementedError('subclasses of LazyObject must provide a _setup() method')
261 261
 
262 262
     # Introspection support
263 263
     __dir__ = new_method_proxy(dir)
2  django/utils/regex_helper.py
@@ -92,7 +92,7 @@ def normalize(pattern):
92 92
                 result.append(".")
93 93
             elif ch == '|':
94 94
                 # FIXME: One day we'll should do this, but not in 1.0.
95  
-                raise NotImplementedError
  95
+                raise NotImplementedError('Awaiting Implementation')
96 96
             elif ch == "^":
97 97
                 pass
98 98
             elif ch == '$':
4  tests/mail/tests.py
@@ -443,10 +443,10 @@ def assertStartsWith(self, first, second):
443 443
             self.assertEqual(first[:len(second)], second, "First string doesn't start with the second.")
444 444
 
445 445
     def get_mailbox_content(self):
446  
-        raise NotImplementedError
  446
+        raise NotImplementedError('subclasses of BaseEmailBackendTests must provide a get_mailbox_content() method')
447 447
 
448 448
     def flush_mailbox(self):
449  
-        raise NotImplementedError
  449
+        raise NotImplementedError('subclasses of BaseEmailBackendTests may require a flush_mailbox() method')
450 450
 
451 451
     def get_the_message(self):
452 452
         mailbox = self.get_mailbox_content()

0 notes on commit b2b7634

Please sign in to comment.
Something went wrong with that request. Please try again.