def email_recipient(self, subject, content, **kwargs):
email_kwargs = {}<EOL>for list_arg in [<EOL>'<STR_LIT:to>','<STR_LIT>','<STR_LIT>',<EOL>]:<EOL><INDENT>email_kwargs[list_arg] = kwargs.pop(list_arg,[]) or []<EOL>if isinstance(email_kwargs[list_arg],string_types):<EOL><INDENT>email_kwargs[list_arg] = [email_kwargs[list_arg],]<EOL><DEDENT><DEDENT>for none_arg in ['<STR_LIT>','<STR_LIT>']:<EOL><INDENT>email_kwargs[none_arg] = kwargs.pop(none_arg,None) or None<EOL><DEDENT>if kwargs.pop('<STR_LIT>',False) and kwargs.get('<STR_LIT>'):<EOL><INDENT>email_kwargs['<STR_LIT>'] = render_to_string(<EOL>'<STR_LIT>',<EOL>context={'<STR_LIT>': kwargs.get('<STR_LIT>'),'<STR_LIT>': subject}<EOL>)<EOL><DEDENT>email_kwargs['<STR_LIT>'] = kwargs.pop('<STR_LIT>',getConstant('<STR_LIT>')) orgetConstant('<STR_LIT>')<EOL>email_kwargs['<STR_LIT>'] = kwargs.pop('<STR_LIT>',getConstant('<STR_LIT>')) orgetConstant('<STR_LIT>')<EOL>default_recipients = self.get_default_recipients() or []<EOL>if isinstance(default_recipients,string_types):<EOL><INDENT>default_recipients = [default_recipients,]<EOL><DEDENT>email_kwargs['<STR_LIT>'] += default_recipients<EOL>if not (email_kwargs['<STR_LIT>'] or email_kwargs['<STR_LIT>'] or email_kwargs['<STR_LIT:to>']):<EOL><INDENT>raise ValueError(_('<STR_LIT>'))<EOL><DEDENT>has_tags = re.search('<STR_LIT>',content)<EOL>if not has_tags:<EOL><INDENT>t = Template(content)<EOL>rendered_content = t.render(Context(kwargs))<EOL>sendEmail(subject,rendered_content,**email_kwargs)<EOL>return<EOL><DEDENT>template_context = self.get_email_context() or {}<EOL>template_context.update(kwargs)<EOL>content = re.sub(<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>content<EOL>)<EOL>t = Template(content)<EOL>rendered_content = t.render(Context(template_context))<EOL>if email_kwargs.get('<STR_LIT>'):<EOL><INDENT>html_content = re.sub(<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>email_kwargs.get('<STR_LIT>')<EOL>)<EOL>t = Template(html_content)<EOL>email_kwargs['<STR_LIT>'] = t.render(Context(template_context))<EOL><DEDENT>sendEmail(subject,rendered_content,**email_kwargs)<EOL>
This method allows for direct emailing of an object's recipient(s)
(default or manually specified), with both object-specific context
provided using the get_email_context() method.  This is used, for example,
to email an individual registrant or the recipient of an individual invoice.