<commit_before># app/controllers/public_body_controller.rb:
# Show information about a public body.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: <EMAIL>; WWW: http://www.mysociety.org/
#
# $Id: public_body_controller.rb,v 1.8 2009-09-14 13:27:00 francis Exp $

require 'csv'

class PublicBodyController < ApplicationController
    # XXX tidy this up with better error messages, and a more standard infrastructure for the redirect to canonical URL
    def show
        long_cache
        if MySociety::Format.simplify_url_part(params[:url_name], 'body') != params[:url_name]
            redirect_to :url_name =>  MySociety::Format.simplify_url_part(params[:url_name], 'body'), :status => :moved_permanently 
            return
        end
        @locale = self.locale_from_params()
        PublicBody.with_locale(@locale) do 
            @public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
            raise ActiveRecord::RecordNotFound.new("None found") if @public_body.nil? # XXX proper 404
            if @public_body.url_name.nil?<commit_msg>Show 404 instead of error page when body can't be found. Fixes #196<commit_after># app/controllers/public_body_controller.rb:
# Show information about a public body.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: <EMAIL>; WWW: http://www.mysociety.org/
#
# $Id: public_body_controller.rb,v 1.8 2009-09-14 13:27:00 francis Exp $

require 'csv'

class PublicBodyController < ApplicationController
    # XXX tidy this up with better error messages, and a more standard infrastructure for the redirect to canonical URL
    def show
        long_cache
        if MySociety::Format.simplify_url_part(params[:url_name], 'body') != params[:url_name]
            redirect_to :url_name =>  MySociety::Format.simplify_url_part(params[:url_name], 'body'), :status => :moved_permanently 
            return
        end
        @locale = self.locale_from_params()
        PublicBody.with_locale(@locale) do 
            @public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
            if @public_body.nil?
                render :template => 'public/404.html'
                return
            end
            if @public_body.url_name.nil?
{'fraction_non_alphanumeric': 0.09856083733100741, 'fraction_numerical': 0.0226777147841256, 'mean_word_length': 3.3446969696969697, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, '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': '6069884', 'n_tokens_mistral': 733, 'n_tokens_neox': 665, 'n_words': 178}