On Wed, Aug 26, 2009 at 12:52 PM, Russell Keith-Magee < freakboy3...@gmail.com> wrote:
> > On Wed, Aug 26, 2009 at 4:41 PM, Joshua Russo<josh.r.ru...@gmail.com> > wrote: > > I figured someone had done this at some time. > > What's the general consensus on when some thing like this should > > be considered to be added to the project and when it should just stay as > an > > outside utility? > > It's certainly worth putting up as a ticket. I can agree with the > original use case - that is, using the client.get() to construct the > prototype data dictionary that will be passed to client.post(). You > only have to look at the work that is done in the admin tests to see > the value in this proposal. > > However, I have some reservations about the patch. > > Most notably, I'm not sure I see how your patch answers the original > use case. The form data structure that is returned by the parser > appears to contain a top-level dictionary containing the form > instances. The form structure itself is irrelevant to reposting. > > However, thats not to say that keeping the form data is irrelevant. > For example, consider the case where a page has multiple forms, or > multiple submit buttons on a single form. If we're going to introduce > a utility like this, then it should be able to behave at least > partially like a browser - that is, I should be able to get the post > data that is needed to respond to a specific button press: > > response = self.client.get('/path/to/page') > # Get a copy of a data dictionary that contains the form data > # that would be submitted if I pressed the submit button labeled 'button 3' > data = response.form_data('button 3') > data['some-field'] = 'new value' > response = self.client.post('/path/to/page', data) > > We also need to be careful of feature creep - this sort of testing is > exactly what Twill does, and we don't want to duplicate the efforts of > that project (or any other automated Python client test framework for > that matter). > That seems reasonable. I'll work on it and let you know when I have an official patch ready. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---