File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -276,12 +276,22 @@ def clean_from_contact(self):
276276 raise forms .ValidationError ('Email address does not exist' )
277277 return email
278278
279+ # Note to future person: This is the wrong place to fix the new lines
280+ # in cc_contacts and to_contacts. Those belong in the save function.
281+ # Or at least somewhere other than here.
279282 def clean_cc_contacts (self ):
280283 '''Return a comma separated list of addresses'''
281284 cc_contacts = self .cleaned_data .get ('cc_contacts' )
282285 cc_contacts = cc_contacts .replace ('\r \n ' ,',' )
283286 cc_contacts = cc_contacts .rstrip (',' )
284287 return cc_contacts
288+ ## to_contacts can also have new lines
289+ def clean_to_contacts (self ):
290+ '''Return a comma separated list of addresses'''
291+ to_contacts = self .cleaned_data .get ('to_contacts' )
292+ to_contacts = to_contacts .replace ('\r \n ' ,',' )
293+ to_contacts = to_contacts .rstrip (',' )
294+ return to_contacts
285295
286296 def clean (self ):
287297 if not self .cleaned_data .get ('body' , None ) and not self .has_attachments ():
You can’t perform that action at this time.
0 commit comments