On Thu, 2008-10-23 at 21:23 -0700, Brandon Taylor wrote: > Hi everyone, > > I'm using Django 1.0, and attempting to do some comment moderation > with Akismet. When I try to wire up a pre_save signal, I'm getting an > error saying 'instance' is not defined. Here is my code: > > def moderate_comment(sender, **kwargs): > if not instance.id: # <-- instance is not defined
Which is correct. kwargs['instance'] may well be defined, however. Python doesn't put kwargs keys into the local namespace, since that would lead to no end of confusion and conflicts. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---