Changeset 1328
- Timestamp:
- 11/21/05 04:41:54 (3 years ago)
- Files:
-
- django/trunk/django/core/validators.py (modified) (3 diffs)
- django/trunk/django/utils/functional.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/core/validators.py
r1202 r1328 28 28 from django.conf.settings import JING_PATH 29 29 from django.utils.translation import gettext_lazy, ngettext 30 from django.utils.functional import Promise 30 31 31 32 class ValidationError(Exception): … … 35 36 self.messages = message 36 37 else: 37 assert isinstance(message, basestring), ("%s should be a string" % repr(message))38 assert isinstance(message, (basestring, Promise)), ("%s should be a string" % repr(message)) 38 39 self.messages = [message] 39 40 def __str__(self): … … 50 51 self.messages = message 51 52 else: 52 assert isinstance(message, basestring), ("'%s' should be a string" % message)53 assert isinstance(message, (basestring, Promise)), ("'%s' should be a string" % message) 53 54 self.messages = [message] 54 55 def __str__(self): django/trunk/django/utils/functional.py
r1098 r1328 3 3 return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items())) 4 4 return _curried 5 6 class Promise: 7 """ 8 This is just a base class for the proxy class created in 9 the closure of the lazy function. It can be used to recognize 10 promises in code. 11 """ 12 pass 5 13 6 14 def lazy(func, *resultclasses): … … 11 19 function is evaluated on every access. 12 20 """ 13 class __proxy__ :21 class __proxy__(Promise): 14 22 # This inner class encapsulates the code that should be evaluated 15 23 # lazily. On calling of one of the magic methods it will force
