Hi Jacob,

Thanks for the reply. My fault - I misread the post_save
documentation, and thought it was able to accept **kwargs. I was able
to work around the problem another way by just adding a @property to
the model in question I can call from the instance passed to the
signal.

Brandon

On Mar 7, 10:26 pm, Jacob Kaplan-Moss <[email protected]>
wrote:
> On Sat, Mar 7, 2009 at 11:14 PM, Brandon Taylor <[email protected]> 
> wrote:
> > When I attempt to pass a keyword arg to it:
>
> > models.signals.post_save.connect(scrub_directory, sender=TheModel,
> > {'my_kwarg' : 'some_value'})
>
> > I get a syntax error: keyword argument appeared after a non-keyword
> > argument.
>
> Well, you're getting a syntax error because, erm, you have a syntax error.
>
> What you've got in that line is a positional argument
> (`scrub_directory`) followed by a keyword argument
> (`sender=TheModel`), followed by a positional argument (the dictionary
> `{'my_kwarg' : 'some_value'}`). You can't intersperse keyword and
> positional arguments like that.
>
> You probably want `connect(scrub_directory, sender=TheModel,
> my_kwarg='some_value')` or, if you've got a dictionary of arbitrary
> arguments, `connect(..., **mydict)`.
>
> If you want to understand what's going on there, spend some time
> brushing up on defining and calling functions in 
> Python.http://martyalchin.com/2007/nov/22/dynamic-functions/is a good place
> to start, and the complete, in-depth guide is 
> athttp://docs.python.org/tutorial/controlflow.html#more-on-defining-fun....
>
> Jacob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to