magic-removal: Spacing change in dispatcher.connect() calls

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1939 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-01-13 04:26:28 +00:00
parent 22260f968c
commit a9297c7a5d
3 changed files with 12 additions and 27 deletions

View File

@ -520,11 +520,7 @@ class FileField(Field):
lambda instance, filename, raw_contents: lambda instance, filename, raw_contents:
instance._save_FIELD_file(self,filename, raw_contents) instance._save_FIELD_file(self,filename, raw_contents)
) )
dispatcher.connect( dispatcher.connect(self.delete_file, signal=signals.post_delete, sender=cls)
self.delete_file,
signal = signals.post_delete,
sender = cls
)
def delete_file(self, instance): def delete_file(self, instance):
if getattr(instance, f.attname): if getattr(instance, f.attname):

View File

@ -1,5 +1,5 @@
from django.db.models import signals from django.db.models import signals
from django.db.models.fields import Field, IntegerField from django.db.models.fields import AutoField, Field, IntegerField
from django.db.models.related import RelatedObject from django.db.models.related import RelatedObject
from django.utils.translation import gettext_lazy, string_concat from django.utils.translation import gettext_lazy, string_concat
from django.utils.functional import curry from django.utils.functional import curry
@ -26,14 +26,10 @@ def do_pending_lookups(sender):
field.rel.to = other_cls field.rel.to = other_cls
field.do_related_class(other_cls, rel_cls) field.do_related_class(other_cls, rel_cls)
dispatcher.connect( dispatcher.connect(do_pending_lookups, signal=signals.class_prepared)
do_pending_lookups,
signal = signals.class_prepared
)
#HACK #HACK
class RelatedField(object): class RelatedField(object):
def contribute_to_class(self, cls, name): def contribute_to_class(self, cls, name):
sup = super(RelatedField, self) sup = super(RelatedField, self)
if hasattr(sup, 'contribute_to_class'): if hasattr(sup, 'contribute_to_class'):
@ -92,7 +88,7 @@ class ForeignKey(SharedMethods, Field):
related_name=kwargs.pop('related_name', None), related_name=kwargs.pop('related_name', None),
limit_choices_to=kwargs.pop('limit_choices_to', None), limit_choices_to=kwargs.pop('limit_choices_to', None),
lookup_overrides=kwargs.pop('lookup_overrides', None), lookup_overrides=kwargs.pop('lookup_overrides', None),
raw_id_admin=kwargs.pop('raw_id_admin', False)) raw_id_admin=kwargs.pop('raw_id_admin', False))
Field.__init__(self, **kwargs) Field.__init__(self, **kwargs)
for name in ('num_in_admin', 'min_num_in_admin', 'max_num_in_admin', 'num_extra_on_change'): for name in ('num_in_admin', 'min_num_in_admin', 'max_num_in_admin', 'num_extra_on_change'):
@ -183,14 +179,14 @@ class OneToOneField(SharedMethods, IntegerField):
related_name=kwargs.pop('related_name', None), related_name=kwargs.pop('related_name', None),
limit_choices_to=kwargs.pop('limit_choices_to', None), limit_choices_to=kwargs.pop('limit_choices_to', None),
lookup_overrides=kwargs.pop('lookup_overrides', None), lookup_overrides=kwargs.pop('lookup_overrides', None),
raw_id_admin=kwargs.pop('raw_id_admin', False)) raw_id_admin=kwargs.pop('raw_id_admin', False))
kwargs['primary_key'] = True kwargs['primary_key'] = True
IntegerField.__init__(self, **kwargs) IntegerField.__init__(self, **kwargs)
for name in ('num_in_admin'): for name in ('num_in_admin'):
if name in kwargs: if name in kwargs:
self.deprecated_args.append(name) self.deprecated_args.append(name)
if not self.db_index: if not self.db_index:
self.db_index = True self.db_index = True
@ -203,7 +199,7 @@ class OneToOneField(SharedMethods, IntegerField):
rel_class=related.model, rel_field=related.field)) rel_class=related.model, rel_field=related.field))
if not cls._meta.one_to_one_field: if not cls._meta.one_to_one_field:
cls._meta.one_to_one_field = self cls._meta.one_to_one_field = self
class ManyToManyField(RelatedField, Field): class ManyToManyField(RelatedField, Field):
def __init__(self, to, **kwargs): def __init__(self, to, **kwargs):
kwargs['verbose_name'] = kwargs.get('verbose_name', None) kwargs['verbose_name'] = kwargs.get('verbose_name', None)
@ -218,8 +214,8 @@ class ManyToManyField(RelatedField, Field):
for name in ('num_in_admin'): for name in ('num_in_admin'):
if name in kwargs: if name in kwargs:
self.deprecated_args.append(name) self.deprecated_args.append(name)
if self.rel.raw_id_admin: if self.rel.raw_id_admin:
msg = gettext_lazy(' Separate multiple IDs with commas.') msg = gettext_lazy(' Separate multiple IDs with commas.')
else: else:
@ -321,11 +317,7 @@ class ManyToManyFieldNew(RelatedField):
#Now we know both classes exist. #Now we know both classes exist.
self.to = cls self.to = cls
# We need to wait until the class we were in was fully defined # We need to wait until the class we were in was fully defined
dispatcher.connect( dispatcher.connect(self.from_prepared, signal=signals.class_prepared, sender=self.from_)
self.from_prepared,
signal = signals.class_prepared,
sender = self.from_
)
def from_prepared(self): def from_prepared(self):
from django.db.models.base import Model from django.db.models.base import Model

View File

@ -14,10 +14,7 @@ def add_manipulators(sender):
cls.add_to_class('AddManipulator', ModelAddManipulator) cls.add_to_class('AddManipulator', ModelAddManipulator)
cls.add_to_class('ChangeManipulator', ModelChangeManipulator) cls.add_to_class('ChangeManipulator', ModelChangeManipulator)
dispatcher.connect( dispatcher.connect(add_manipulators, signal=signals.class_prepared)
add_manipulators,
signal=signals.class_prepared
)
class ManipulatorDescriptor(object): class ManipulatorDescriptor(object):
def __init__(self, name, base): def __init__(self, name, base):