magic-removal: Merged to [1717]

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1718 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-12-17 19:35:04 +00:00
parent bb874b690a
commit 06332287a8
4 changed files with 60 additions and 65 deletions

View File

@ -121,9 +121,6 @@ def cmp_cls(x, y):
return 1 return 1
return 0 return 0
class Model(object): class Model(object):
__metaclass__ = ModelBase __metaclass__ = ModelBase
@ -134,7 +131,6 @@ class Model(object):
setattr(cls, name, attribute) setattr(cls, name, attribute)
add_to_class = classmethod(add_to_class) add_to_class = classmethod(add_to_class)
def __repr__(self): def __repr__(self):
return '<%s object>' % self.__class__.__name__ return '<%s object>' % self.__class__.__name__

View File

@ -570,9 +570,8 @@ class ImageField(FileField):
def contribute_to_class(self, cls, name): def contribute_to_class(self, cls, name):
super(FileField, self).contribute_to_class(cls, name) super(FileField, self).contribute_to_class(cls, name)
# Add get_BLAH_width and get_BLAH_height methods, but only # Add get_BLAH_width and get_BLAH_height methods, but only if the
# if the image field doesn't have width and height cache # image field doesn't have width and height cache fields.
# fields.
if not self.width_field: if not self.width_field:
setattr(cls, 'get_%s_width' % self.name, curry(cls._get_FIELD_width, field=self)) setattr(cls, 'get_%s_width' % self.name, curry(cls._get_FIELD_width, field=self))
if not self.height_field: if not self.height_field:

View File

@ -131,11 +131,12 @@ class AutomaticManipulator(Manipulator):
if child_follow: if child_follow:
obj_list = expanded_data[related.var_name].items() obj_list = expanded_data[related.var_name].items()
obj_list.sort(lambda x, y: cmp(int(x[0]), int(y[0]))) obj_list.sort(lambda x, y: cmp(int(x[0]), int(y[0])))
params = {}
# For each related item... # For each related item...
for _, rel_new_data in obj_list: for _, rel_new_data in obj_list:
params = {}
# Keep track of which core=True fields were provided. # Keep track of which core=True fields were provided.
# If all core fields were given, the related object will be saved. # If all core fields were given, the related object will be saved.
# If none of the core fields were given, the object will be deleted. # If none of the core fields were given, the object will be deleted.
@ -329,4 +330,3 @@ def manipulator_validator_unique_for_date(from_field, date_field, opts, lookup_t
format_string = (lookup_type == 'date') and '%B %d, %Y' or '%B %Y' format_string = (lookup_type == 'date') and '%B %d, %Y' or '%B %Y'
raise validators.ValidationError, "Please enter a different %s. The one you entered is already being used for %s." % \ raise validators.ValidationError, "Please enter a different %s. The one you entered is already being used for %s." % \
(from_field.verbose_name, date_val.strftime(format_string)) (from_field.verbose_name, date_val.strftime(format_string))