Dave, that is the problem. I need to be able to call perform elsewhere in the code (not necessarily from a view), and it would be difficult to build the datadict to do that.
I like your solution, though. For now I'm using this loop: data = {} for key in request.POST.keys(): data[str(key)] = str(request.POST[key]) ab.perform(**data) which works, but it bugs me a little. I don't think I'll have that many POST items that it will be a big deal, and I suppose any method built into request.POST would have to do the same thing. I like your solution, Dave. I'll give it a try. On Oct 9, 8:16 pm, "David Durham, Jr." <[EMAIL PROTECTED]> wrote: > > I do not understand why you want to do this. Why not just pass request.POST > > without the **, and declare your function to take a single argument which > > you expect to be a dictionary-like object (as request.POST, a QueryDict, > > is)?. That is: > > > result = ab.perform(request.POST) > > where: > > def perform(self, datadict): > > > What could you do with 'kwargs' in your syntax that you cannot do with > > 'datadict' in this alternative? > > What if he wanted to do something like: > > ab.perform(name='x', y=12) or whatever, but also have the option to use > ab.perform(**a_dict) or > ab.perform(a_dict) > > Can you do something like: > > def perform(self, datadict=None, **kwargs): > if datadict is None: > datadict = kwargs > elif kwargs is not None: > datadict.update(kwargs) > > I'm not sure that this would work; just kind of thinking out loud. > > -Dave --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---