aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/request_controller.rb4
-rw-r--r--app/models/info_request.rb2
-rw-r--r--app/models/user.rb2
3 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 3296db6b7..c732a4b32 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -44,7 +44,7 @@ class RequestController < ApplicationController
end
def show
- if !Configuration::varnish_host.nil?
+ if !Configuration::varnish_host.blank?
# If varnish is set up to accept PURGEs, then cache for a
# long time
long_cache
@@ -876,7 +876,7 @@ class RequestController < ApplicationController
Zip::ZipFile.open(file_path, Zip::ZipFile::CREATE) { |zipfile|
convert_command = Configuration::html_to_pdf_command
done = false
- if File.exists?(convert_command)
+ if !convert_command.blank? && File.exists?(convert_command)
url = "http://#{Configuration::domain}#{request_url(info_request)}?print_stylesheet=1"
tempfile = Tempfile.new('foihtml2pdf')
output = AlaveteliExternalCommand.run(convert_command, url, tempfile.path)
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 47424e573..89893a396 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1139,7 +1139,7 @@ public
before_save :purge_in_cache
def purge_in_cache
- if !Configuration::varnish_host.nil? && !self.id.nil?
+ if !Configuration::varnish_host.blank? && !self.id.nil?
# we only do this for existing info_requests (new ones have a nil id)
path = url_for(:controller => 'request', :action => 'show', :url_title => self.url_title, :only_path => true, :locale => :none)
req = PurgeRequest.find_by_url(path)
diff --git a/app/models/user.rb b/app/models/user.rb
index 4a68d60d1..70386f7e4 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -286,7 +286,7 @@ class User < ActiveRecord::Base
return false if self.no_limit
# Has the user issued as many as MAX_REQUESTS_PER_USER_PER_DAY requests in the past 24 hours?
- return false if Configuration::max_requests_per_user_per_day.nil?
+ return false if Configuration::max_requests_per_user_per_day.blank?
recent_requests = InfoRequest.count(:conditions => ["user_id = ? and created_at > now() - '1 day'::interval", self.id])
return (recent_requests >= Configuration::max_requests_per_user_per_day)