test zip down

This commit is contained in:
yanxd 2014-04-16 14:44:26 +08:00
parent 84d3e40c41
commit cabceb0064
3 changed files with 9 additions and 3 deletions

View File

@ -10,8 +10,9 @@ class ZipdownController < ApplicationController
logger.error "[ZipDown#assort] ===> #{obj.class.to_s.to_sym} unKown !!" logger.error "[ZipDown#assort] ===> #{obj.class.to_s.to_sym} unKown !!"
end end
rescue NameError,ActiveRecord::RecordNotFound => e rescue NameError, ActiveRecord::RecordNotFound => e
logger.error "[ZipDown] ===> #{e}" logger.error "[ZipDown] ===> #{e}"
@error = e
end end
private private
@ -31,7 +32,7 @@ class ZipdownController < ApplicationController
:type => detect_content_type(zipfile) :type => detect_content_type(zipfile)
rescue Errno::ENOENT => e rescue Errno::ENOENT => e
logger.error "[Errno::ENOENT] ===> #{e}" logger.error "[Errno::ENOENT] ===> #{e}"
@error = e
end end
def ziping files_path def ziping files_path
@ -50,6 +51,9 @@ class ZipdownController < ApplicationController
} }
end end
zipfile_name zipfile_name
rescue Errno=> e
logger.error "[zipdown#zipping] ===> #{e}"
@error = e
end end
def detect_content_type(name) def detect_content_type(name)

View File

@ -17,7 +17,7 @@
<%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;display: inline-block;" if( User.current.admin? || <%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;display: inline-block;" if( User.current.admin? ||
!(User.current.roles_for_project(@bid.courses.first).map(&:id) & !(User.current.roles_for_project(@bid.courses.first).map(&:id) &
([7,9, 10])).empty? ([7,9, 10])).empty?
) && Rails.env.development? %> ) && (true || Rails.env.development?) %>
<% @homework_list.each do |homework|%> <% @homework_list.each do |homework|%>
<% if homework.attachments.any?%> <% if homework.attachments.any?%>
<table width="660px" border="0" align="center"> <table width="660px" border="0" align="center">

View File

@ -0,0 +1,2 @@
<h1>Download Status:</h1>
<%= @error.class %>