On 06/07/06 05:11, Adrian Holovaty wrote: > http://code.djangoproject.com/wiki/NewbieMistakes#POSTtoviewslosesPOSTdata > > It's about time to solve this one. Who has a creative, elegant solution? :-) > > Some ideas, just to start discussion -- > > * THROW ERROR ON POST: The CommonMiddleware, when adding a slash and > redirecting, can check for POST data. If it finds any, it somehow logs > the error or otherwise alerts the developer. Maybe if DEBUG=True it > can actually display an error, with a custom-built message saying "You > need to change so-and-so form action to so-and-so URL"? I can't think > of any case in which a POST to a page that needs to be redirected > would be intentional, and if we only do it for DEBUG=True I think this > may be acceptable. > > * THROW ERROR ON FORM DISPLAY: If the APPEND_SLASH setting is set to > True and the CommonMiddleware is activated, Django could check the > output of every page for a <form> whose method is POST and has an > "action" whose URL doesn't end in a slash. Then it could somehow alter > the page to display an error on it. This solution is horrific, but I'm > mentioning it here for diversity. > > Adrian >
It probably needs some more thought and may be to 'magical', but how about something like this: ---------- POST /some/url - store POST/GET data as /tmp/78fsd8fasdf7ad8asaf7889sdf - log error message, send email to admin - redirect to /some/url/?cm_data_id=78fsd8fasdf7ad8asaf7889sdf ---------- GET /some/url/?cm_data_id=78fsd8fasdf7ad8asaf7889sdf - load POST/GET data from /tmp/78fsd8fasdf7ad8asaf7889sdf, populate POST/GET dicts with it - remove cm_data_id from GET variables - delete /tmp/78fsd8fasdf7ad8asaf7889sdf - log message that data has been picked up I believe you do something similar in the admin when a session is expired and you redirect to the login form. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers -~----------~----~----~----~------~----~------~--~---