From 1200356c1cbbb0b69d9082e584488fba03b6d4cb Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Mon, 27 Mar 2006 23:04:41 +0000 Subject: [PATCH] magic-removal: Folded django.db.models.options.Options.merge_meta into contribute_to_class(). No need to make it a separate method. git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2570 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/options.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/django/db/models/options.py b/django/db/models/options.py index d5b7089fa4..93109bd4e3 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -33,15 +33,6 @@ class Options: self.one_to_one_field = None self.parents = [] - def merge_meta(self): - meta_attrs = self.meta.__dict__ - del meta_attrs['__module__'] - del meta_attrs['__doc__'] - for attr_name in DEFAULT_NAMES: - setattr(self, attr_name, meta_attrs.pop(attr_name, getattr(self, attr_name))) - if meta_attrs != {}: - raise TypeError, "'class Meta' got invalid attribute(s): %s" % ','.join(meta_attrs.keys()) - def contribute_to_class(self, cls, name): cls._meta = self self.object_name = cls.__name__ @@ -51,7 +42,13 @@ class Options: self.verbose_name = get_verbose_name(self.object_name) self.verbose_name_plural = self.verbose_name + 's' if self.meta: - self.merge_meta() + meta_attrs = self.meta.__dict__ + del meta_attrs['__module__'] + del meta_attrs['__doc__'] + for attr_name in DEFAULT_NAMES: + setattr(self, attr_name, meta_attrs.pop(attr_name, getattr(self, attr_name))) + if meta_attrs != {}: + raise TypeError, "'class Meta' got invalid attribute(s): %s" % ','.join(meta_attrs.keys()) del self.meta def _prepare(self, model): @@ -217,7 +214,7 @@ class AdminOptions: fs_options = fieldset[1] classes = fs_options.get('classes', ()) description = fs_options.get('description', '') - new_fieldset_list.append(AdminFieldSet(fieldset[0], classes, + new_fieldset_list.append(AdminFieldSet(fieldset[0], classes, opts.get_field, fs_options['fields'], description)) return new_fieldset_list