1
0
mirror of https://github.com/django/django.git synced 2025-10-25 22:56:12 +00:00

boulder-oracle-sprint: Merged to [4905].

git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@4906 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Boulder Sprinters
2007-04-02 15:36:31 +00:00
parent b86d69f529
commit a3053273c8
65 changed files with 4729 additions and 2823 deletions

View File

@@ -22,7 +22,12 @@ class ModelBase(type):
"Metaclass for all models"
def __new__(cls, name, bases, attrs):
# If this isn't a subclass of Model, don't do anything special.
if name == 'Model' or not filter(lambda b: issubclass(b, Model), bases):
try:
if not filter(lambda b: issubclass(b, Model), bases):
return super(ModelBase, cls).__new__(cls, name, bases, attrs)
except NameError:
# 'Model' isn't defined yet, meaning we're looking at Django's own
# Model class, defined below.
return super(ModelBase, cls).__new__(cls, name, bases, attrs)
# Create the class.