summaryrefslogtreecommitdiff
path: root/django/core/validators.py
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-09-15 21:57:25 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-09-15 21:57:25 +0000
commitca33d307dee3cf68cc9cd2ccfae00c7ff23ea890 (patch)
treee0f0afa392f4ab50de4a89e2a0b1b4cc53f40794 /django/core/validators.py
parent7325fbf4ff20f9b0f21d3a1aba1abaca78a765d7 (diff)
queryset-refactor: Merged to [6300]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6340 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/validators.py')
-rw-r--r--django/core/validators.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/django/core/validators.py b/django/core/validators.py
index 7611aef921..874edaefdd 100644
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -405,12 +405,17 @@ class NumberIsInRange(object):
class IsAPowerOf(object):
"""
- >>> v = IsAPowerOf(2)
- >>> v(4, None)
- >>> v(8, None)
- >>> v(16, None)
- >>> v(17, None)
- django.core.validators.ValidationError: ['This value must be a power of 2.']
+ Usage: If you create an instance of the IsPowerOf validator:
+ v = IsAPowerOf(2)
+
+ The following calls will succeed:
+ v(4, None)
+ v(8, None)
+ v(16, None)
+
+ But this call:
+ v(17, None)
+ will raise "django.core.validators.ValidationError: ['This value must be a power of 2.']"
"""
def __init__(self, power_of):
self.power_of = power_of