<commit_before># models/application_mailer.rb:
# Shared code between different mailers.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: <EMAIL>; WWW: http://www.mysociety.org/

require 'action_mailer/version'
class ApplicationMailer < ActionMailer::Base
    # Include all the functions views get, as emails call similar things.
    helper :application
    include MailerHelper

    # This really should be the default - otherwise you lose any information
    # about the errors, and have to do error checking on return codes.
    self.raise_delivery_errors = true

    def blackhole_email
        AlaveteliConfiguration::blackhole_prefix+"@"+AlaveteliConfiguration::incoming_email_domain
    end

    # URL generating functions are needed by all controllers (for redirects),
    # views (for links) and mailers (for use in emails), so include them into
    # all of all.
    include LinkToHelper

    # Site-wide access to configuration settings
    include ConfigHelper

    # For each multipart template (e.g. "the_template_file.text.html.erb") available,
    # add the one from the view path with the highest priority as a part to the mail
    def render_multipart_templates
        added_content_types = {}
        self.view_paths.each do |view_path|
            Dir.glob("#{view_path}/#{mailer_name}/#{@template}.*").each do |path|
              template = view_path["#{mailer_name}/#{File.basename(path)}"]

              # Skip unless template has a multipart format
              next unless template && template.multipart?
              next if added_content_types[template.content_type] == true
              @parts << Part.new(
                :content_type => template.content_type,
                :disposition => "inline",
                :charset => charset,
                :body => render_message(template, @body)
              )
              added_content_types[template.content_type] = true
            end
        end
    end

    # Look for the current template in each element of view_paths in order,
    # return the first
    def find_template
        self.view_paths.each do |view_path|
            if template = view_path["#{mailer_name}/#{@template}"]
                return template
            end
        end
        return nil
    end
end
<commit_msg>Remove mailer patch methods that are no longer needed.<commit_after># models/application_mailer.rb:
# Shared code between different mailers.
#
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: <EMAIL>; WWW: http://www.mysociety.org/

require 'action_mailer/version'
class ApplicationMailer < ActionMailer::Base
    # Include all the functions views get, as emails call similar things.
    helper :application
    include MailerHelper

    # This really should be the default - otherwise you lose any information
    # about the errors, and have to do error checking on return codes.
    self.raise_delivery_errors = true

    def blackhole_email
        AlaveteliConfiguration::blackhole_prefix+"@"+AlaveteliConfiguration::incoming_email_domain
    end

    # URL generating functions are needed by all controllers (for redirects),
    # views (for links) and mailers (for use in emails), so include them into
    # all of all.
    include LinkToHelper

    # Site-wide access to configuration settings
    include ConfigHelper

end

{'fraction_non_alphanumeric': 0.07480780603193377, 'fraction_numerical': 0.002365464222353637, 'mean_word_length': 2.8974654377880182, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6866681', 'n_tokens_mistral': 912, 'n_tokens_neox': 877, 'n_words': 316}