From 6493164e9147440fc9d3d0d4dcd3cc3111956e5c Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Wed, 14 Dec 2005 03:54:11 +0000 Subject: [PATCH] magic-removal: Removed _orig_init_args hack in Options class. It was necessary for model subclassing and is no longer necessary. git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1622 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/core/meta/__init__.py | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/django/core/meta/__init__.py b/django/core/meta/__init__.py index aad776a7b0..0e4dd32a0b 100644 --- a/django/core/meta/__init__.py +++ b/django/core/meta/__init__.py @@ -364,26 +364,6 @@ class Options: where_constraints=None, object_name=None, app_label=None, exceptions=None, permissions=None, get_latest_by=None, order_with_respect_to=None, module_constants=None): - - # Save the original function args, for use by copy(). Note that we're - # NOT using copy.deepcopy(), because that would create a new copy of - # everything in memory, and it's better to conserve memory. Of course, - # this comes with the important gotcha that changing any attribute of - # this object will change its value in self._orig_init_args, so we - # need to be careful not to do that. In practice, we can pull this off - # because Options are generally read-only objects, and __init__() is - # the only place where its attributes are manipulated. - - # locals() is used purely for convenience, so we don't have to do - # something verbose like this: - # self._orig_init_args = { - # 'module_name': module_name, - # 'verbose_name': verbose_name, - # ... - # } - self._orig_init_args = locals() - del self._orig_init_args['self'] # because we don't care about it. - # Move many-to-many related fields from self.fields into self.many_to_many. self.fields, self.many_to_many = [], [] for field in (fields or []): @@ -438,11 +418,6 @@ class Options: def __repr__(self): return '' % self.module_name - def copy(self, **kwargs): - args = self._orig_init_args.copy() - args.update(kwargs) - return self.__class__(**args) - def get_model_module(self): return get_module(self.app_label, self.module_name)