From 6d9f4e4ef65b6f8678bb3e8a40b784b4819aa97a Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Wed, 1 Mar 2006 03:51:55 +0000 Subject: [PATCH] Fixed #1213 -- Changed value of NOT_PROVIDED so that it's not a string, to prevent possible (but highly unlikely) collisions. Thanks, akaihola git-svn-id: http://code.djangoproject.com/svn/django/trunk@2454 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/meta/fields.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/django/core/meta/fields.py b/django/core/meta/fields.py index 5cb8b866f5..d01c0af808 100644 --- a/django/core/meta/fields.py +++ b/django/core/meta/fields.py @@ -6,8 +6,8 @@ from django.utils.text import capfirst from django.utils.translation import gettext_lazy, ngettext import datetime, os -# Random entropy string used by "default" param. -NOT_PROVIDED = 'oijpwojefiojpanv' +class NOT_PROVIDED: + pass # Values for filter_interface. HORIZONTAL, VERTICAL = 1, 2 @@ -193,11 +193,11 @@ class Field(object): def has_default(self): "Returns a boolean of whether this field has a default value." - return self.default != NOT_PROVIDED + return self.default is not NOT_PROVIDED def get_default(self): "Returns the default value for this field." - if self.default != NOT_PROVIDED: + if self.default is not NOT_PROVIDED: if hasattr(self.default, '__get_value__'): return self.default.__get_value__() return self.default