On Mon, 2009-02-02 at 23:05 -0800, Mark Jones wrote:
> I have a form that is working well.  However I want to allow them to
> reuse the form multiple times.  Each time they submit the form, I will
> send up to 6 emails.  Then, if an email is sent successfully, 

Right there you have your first problem. Emails aren't necessarily sent
immediately. What does "sent" mean? Accepted by your server? Received at
the target end and not bounced? There are lots of way an email can fail.
Further, it can take some time to send email (connection times and so
on), even just to a local system. So blocking the web response based on
some "success or fail" measure in the email system is a bit fragile.

Maybe you've carefully evaluated all the steps in the pipeline and have
your risks worked out. I'd consider whether you're really solving the
right problem, however.

> I want
> to remove that email address from the form that I present to them.  If
> the email isn't successfully sent, I want to move that field up the
> list.
> 
> The problem comes when I get to
> 
>             self.data[friend] = ''
> 
> inside clearsent
> 
> When I work thru this in the shell, it works as expected, but when
> runserver is going, it generates the error: This QueryDict instance is
> immutable
> 
> I don't want to clear all the fields, I want to leave the email
> subject and body alone and clear the 'To' fields and present the form
> for another round of emails to be sent.  How do you do this?

Copy the data dictionary: request.POST.copy() is the usual idiom when
you want to change something like that. You can't change Django's copy
of the data, but you can certainly make your own copy and change that.

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 [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