Closed josephmarlin closed 10 years ago
Is encode correct? Please check.
Is what encoding correct? The encoding on the imported CSV file?
I'm getting the same exact issue on 2.3.1. I'm even using your included sample files in test/samples.
I just installed the same plugin and I am experiencing the same issue.
Environment: Redmine version 2.1.2.stable Ruby version 1.8.7 (x86_64-linux) Rails version 3.2.8 Environment production Database adapter PostgreSQL Redmine plugins: redmine_importer 1.2.2
Are there any updates?
This happens with Ruby 1.8.x. The CSV class in Ruby 1.9.x has a 2 argument constructor which this code uses but does not exist in 1.8.x. You will need Ruby 1.9.x to get around this.
I haven't verified this, but, adding the following code block to importer_controller.rb right after the require 'csv' line should make the code compatible with both Ruby 1.8.x and 1.9.x
See http://edgar.tumblr.com/post/51093838055/migrating-fastercsv-from-ruby-1-8-to-csv-in-1-9
if CSV.const_defined? :Reader
# Ruby 1.8 compatible
require 'fastercsv'
Object.send(:remove_const, :CSV)
CSV = FasterCSV
else
# CSV is now FasterCSV in ruby 1.9
end
From the beginning of this fork, the code was targeting Ruby-1.9.x . As all we know, 1.8.x is not supported any more. For now, I added the piece of code from aner-perez only to the 'develop' branch, but I'm almost sure there will be other 1.8.x related issues as well. Best solution: upgrade your system to Ruby 1.9.x
Redmine version --- 2.3.3.stable After submitting a test csv:
Started GET "/redmine/importer/index?project_id=test" for x.x.x.x at Thu Mar 13 16:49:07 -0400 2014 Processing by ImporterController#index as HTML Parameters: {"project_id"=>"test"} Current user: jmarlin (id=3) Rendered plugins/redmine_importer/app/views/importer/index.html.erb within layouts/base (24.8ms) Completed 200 OK in 566ms (Views: 377.0ms | ActiveRecord: 17.3ms) Started POST "/redmine/importer/match" for 10.5.1.132 at Thu Mar 13 16:49:16 -0400 2014 Processing by ImporterController#match as HTML Parameters: {"project_id"=>"55", "encoding"=>"U", "authenticity_token"=>"", "splitter"=>",", "wrapper"=>"\"", "file"=>#<ActionDispatch::Http::UploadedFile:0x7f6879358750 @tempfile=#<File:/tmp/RackMultipart20140313-21323-1wrazyh-0>, @headers="Content-Disposition: form-data; name=\"file\"; filename=\"test.csv\"\r\nContent-Type: text/csv\r\n", @content_type="text/csv", @original_filename="test.csv">, "utf8"=>"\342\234\223", "commit"=>"Upload File"} Current user: jmarlin (id=3) Completed 500 Internal Server Error in 159ms
ArgumentError (wrong number of arguments (2 for 0)): plugins/redmine_importer/app/controllers/importer_controller.rb:51:in
initialize' plugins/redmine_importer/app/controllers/importer_controller.rb:51:in
new' plugins/redmine_importer/app/controllers/importer_controller.rb:51:inmatch' actionpack (3.2.13) lib/action_controller/metal/implicit_render.rb:4:in
send_action' actionpack (3.2.13) lib/action_controller/metal/implicit_render.rb:4:insend_action' actionpack (3.2.13) lib/abstract_controller/base.rb:167:in
process_action' actionpack (3.2.13) lib/action_controller/metal/rendering.rb:10:inprocess_action' actionpack (3.2.13) lib/abstract_controller/callbacks.rb:18:in
process_action' activesupport (3.2.13) lib/active_support/callbacks.rb:469:in_run__1642363306__process_action__1937525029__callbacks' activesupport (3.2.13) lib/active_support/callbacks.rb:405:in
send' activesupport (3.2.13) lib/active_support/callbacks.rb:405:in__run_callback' activesupport (3.2.13) lib/active_support/callbacks.rb:385:in
_run_process_action_callbacks' activesupport (3.2.13) lib/active_support/callbacks.rb:81:insend' activesupport (3.2.13) lib/active_support/callbacks.rb:81:in
run_callbacks' actionpack (3.2.13) lib/abstract_controller/callbacks.rb:17:inprocess_action' actionpack (3.2.13) lib/action_controller/metal/rescue.rb:29:in
process_action' actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:30:inprocess_action' activesupport (3.2.13) lib/active_support/notifications.rb:123:in
instrument' activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:ininstrument' activesupport (3.2.13) lib/active_support/notifications.rb:123:in
instrument' actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:29:inprocess_action' actionpack (3.2.13) lib/action_controller/metal/params_wrapper.rb:207:in
process_action' activerecord (3.2.13) lib/active_record/railties/controller_runtime.rb:18:inprocess_action' actionpack (3.2.13) lib/abstract_controller/base.rb:121:in
process' actionpack (3.2.13) lib/abstract_controller/rendering.rb:45:inprocess' actionpack (3.2.13) lib/action_controller/metal.rb:203:in
dispatch' actionpack (3.2.13) lib/action_controller/metal/rack_delegation.rb:14:indispatch' actionpack (3.2.13) lib/action_controller/metal.rb:246 actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:73:in
call' actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:73:indispatch' actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:36:in
call' journey (1.0.4) lib/journey/router.rb:68:incall' journey (1.0.4) lib/journey/router.rb:56:in
each' journey (1.0.4) lib/journey/router.rb:56:incall' actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in
call' rack-openid (1.3.1) lib/rack/openid.rb:98:incall' actionpack (3.2.13) lib/action_dispatch/middleware/best_standards_support.rb:17:in
call' rack (1.4.5) lib/rack/etag.rb:23:incall' rack (1.4.5) lib/rack/conditionalget.rb:35:in
call' actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:incall' actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in
call' actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:242:incall' rack (1.4.5) lib/rack/session/abstract/id.rb:210:in
context' rack (1.4.5) lib/rack/session/abstract/id.rb:205:incall' actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:341:in
call' activerecord (3.2.13) lib/active_record/query_cache.rb:64:incall' activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in
call' actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:incall' activesupport (3.2.13) lib/active_support/callbacks.rb:405:in
_run230975519call4callbacks' activesupport (3.2.13) lib/active_support/callbacks.rb:405:insend' activesupport (3.2.13) lib/active_support/callbacks.rb:405:in
run_callback' activesupport (3.2.13) lib/active_support/callbacks.rb:385:in_run_call_callbacks' activesupport (3.2.13) lib/active_support/callbacks.rb:81:in
send' activesupport (3.2.13) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in
call' actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:incall' actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in
call' actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:incall' railties (3.2.13) lib/rails/rack/logger.rb:32:in
call_app' railties (3.2.13) lib/rails/rack/logger.rb:16:incall' activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in
tagged' railties (3.2.13) lib/rails/rack/logger.rb:16:incall' actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in
call' rack (1.4.5) lib/rack/methodoverride.rb:21:incall' rack (1.4.5) lib/rack/runtime.rb:17:in
call' activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:incall' rack (1.4.5) lib/rack/lock.rb:15:in
call' actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:incall' rack-cache (1.2) lib/rack/cache/context.rb:136:in
forward' rack-cache (1.2) lib/rack/cache/context.rb:143:inpass' rack-cache (1.2) lib/rack/cache/context.rb:155:in
invalidate' rack-cache (1.2) lib/rack/cache/context.rb:71:incall!' rack-cache (1.2) lib/rack/cache/context.rb:51:in
call' railties (3.2.13) lib/rails/engine.rb:479:incall' railties (3.2.13) lib/rails/application.rb:223:in
call' railties (3.2.13) lib/rails/railtie/configurable.rb:30:insend' railties (3.2.13) lib/rails/railtie/configurable.rb:30:in
method_missing' /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:97:inprocess_request' /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:520:in
accept_and_process_next_request' /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:274:inmain_loop' /usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:321:in
start_request_handler' /usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:275:insend' /usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:275:in
handle_spawn_application' /usr/lib/ruby/1.8/phusion_passenger/utils.rb:470:insafe_fork' /usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:270:in
handle_spawn_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:357:in `send' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:357:inserver_main_loop' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:206:in
start_synchronously' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:180:instart' /usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:149:in
start' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:219:inspawn_rails_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:132:in
lookup_or_add' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:214:inspawn_rails_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:82:in
synchronize' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:insynchronize' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:213:in
spawn_rails_application' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:132:inspawn_application' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:275:in
handle_spawn_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:357:in `send__' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:357:inserver_main_loop' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:206:in
start_synchronously' /usr/share/phusion-passenger/helper-scripts/passenger-spawn-server:99