aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Legler <a3li@gentoo.org>2011-10-10 22:17:24 +0200
committerAlex Legler <a3li@gentoo.org>2011-10-10 22:17:24 +0200
commit7aaf51eb7a04fb6b312087ba529375b0e8506344 (patch)
tree37fb907e326e5760a0c9ee3e71ce1c489daf1374
parentedit view: Use to_s for all name references, cleanup (diff)
downloadglsamaker-7aaf51eb7a04fb6b312087ba529375b0e8506344.tar.gz
glsamaker-7aaf51eb7a04fb6b312087ba529375b0e8506344.tar.bz2
glsamaker-7aaf51eb7a04fb6b312087ba529375b0e8506344.zip
Use rails-3 template format override
-rw-r--r--app/controllers/glsa_controller.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/app/controllers/glsa_controller.rb b/app/controllers/glsa_controller.rb
index 4c4e51e..df84ea4 100644
--- a/app/controllers/glsa_controller.rb
+++ b/app/controllers/glsa_controller.rb
@@ -321,15 +321,14 @@ class GlsaController < ApplicationController
@glsa.invalidate_last_revision_cache
if params[:email] == '1'
- of = @template_format
- @template_format = 'txt'
- Glsamaker::Mail.send_text(
- render_to_string({:template => 'glsa/show.txt.erb', :format => :txt, :layout => false}),
- "[ GLSA #{@glsa.glsa_id} ] #{@rev.title}",
- current_user,
- false
- )
- @template_format = of
+ with_format('txt') do
+ Glsamaker::Mail.send_text(
+ render_to_string({:template => 'glsa/show.txt.erb', :layout => false}),
+ "[ GLSA #{@glsa.glsa_id} ] #{@rev.title}",
+ current_user,
+ false
+ )
+ end
end
rescue GLSAReleaseError => e
flash[:error] = "Internal error: #{e.message}. Cannot release advisory."