aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-01-12 17:56:56 +0000
committerRobin Houston <robin.houston@gmail.com>2012-01-12 17:56:56 +0000
commit5e400fd939091a12515b069d618b9e7b18bb4016 (patch)
tree6d123ac3565bc5351a7c8fc94819e03460e7e0b9 /app/controllers/application_controller.rb
parentcb020f57f9cec5610c40bbcb85257776c27642a1 (diff)
parent0aafbd4a25b5c4c0edbd87c2224dcdd18388ede5 (diff)
Merge branch 'release/0.5' of https://github.com/sebbacon/alaveteli into release/0.5
Conflicts: app/controllers/request_controller.rb
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 8fd2da54a..7aa522389 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -11,6 +11,8 @@
require 'open-uri'
class ApplicationController < ActionController::Base
+ class PermissionDenied < StandardError
+ end
# Standard headers, footers and navigation for whole site
layout "default"
include FastGettext::Translation # make functions like _, n_, N_ etc available)
@@ -120,6 +122,8 @@ class ApplicationController < ActionController::Base
case exception
when ActiveRecord::RecordNotFound, ActionController::UnknownAction, ActionController::RoutingError
@status = 404
+ when PermissionDenied
+ @status = 403
else
@status = 500
notify_about_exception exception
@@ -189,7 +193,7 @@ class ApplicationController < ActionController::Base
return File.exists?(key_path)
end
def foi_fragment_cache_read(key_path)
- cached = File.read(key_path)
+ return File.read(key_path)
end
def foi_fragment_cache_write(key_path, content)
FileUtils.mkdir_p(File.dirname(key_path))
@@ -367,8 +371,8 @@ class ApplicationController < ActionController::Base
# XXX this is a result of the OR hack below -- should fix by
# allowing a parameter to perform_search to control the
# default operator!
- query = query.gsub(/(\s-\s|&)/, "")
- query = query.split(/ +(?!-)/)
+ query = query.strip.gsub(/(\s-\s|&)/, "")
+ query = query.split(/ +(?![-+]+)/)
if query.last.nil? || query.last.strip.length < 3
xapian_requests = nil
else