zh / redmine_importer

Redmine importer that works with trunk.
https://github.com/leovitch/redmine_importer/wiki
47 stars 57 forks source link

Importer Broken #20

Closed josephmarlin closed 10 years ago

josephmarlin commented 10 years ago

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:innew' plugins/redmine_importer/app/controllers/importer_controller.rb:51:in match' actionpack (3.2.13) lib/action_controller/metal/implicit_render.rb:4:insend_action' actionpack (3.2.13) lib/action_controller/metal/implicit_render.rb:4:in send_action' actionpack (3.2.13) lib/abstract_controller/base.rb:167:inprocess_action' actionpack (3.2.13) lib/action_controller/metal/rendering.rb:10:in process_action' actionpack (3.2.13) lib/abstract_controller/callbacks.rb:18:inprocess_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: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_process_action_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/abstract_controller/callbacks.rb:17:in process_action' actionpack (3.2.13) lib/action_controller/metal/rescue.rb:29:inprocess_action' actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:30:in process_action' activesupport (3.2.13) lib/active_support/notifications.rb:123:ininstrument' activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in instrument' activesupport (3.2.13) lib/active_support/notifications.rb:123:ininstrument' actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:29:in process_action' actionpack (3.2.13) lib/action_controller/metal/params_wrapper.rb:207:inprocess_action' activerecord (3.2.13) lib/active_record/railties/controller_runtime.rb:18:in process_action' actionpack (3.2.13) lib/abstract_controller/base.rb:121:inprocess' actionpack (3.2.13) lib/abstract_controller/rendering.rb:45:in process' actionpack (3.2.13) lib/action_controller/metal.rb:203:indispatch' actionpack (3.2.13) lib/action_controller/metal/rack_delegation.rb:14:in dispatch' actionpack (3.2.13) lib/action_controller/metal.rb:246 actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:73:incall' actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:73:in dispatch' actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:36:incall' journey (1.0.4) lib/journey/router.rb:68:in call' journey (1.0.4) lib/journey/router.rb:56:ineach' journey (1.0.4) lib/journey/router.rb:56:in call' actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:incall' rack-openid (1.3.1) lib/rack/openid.rb:98:in call' actionpack (3.2.13) lib/action_dispatch/middleware/best_standards_support.rb:17:incall' rack (1.4.5) lib/rack/etag.rb:23:in call' rack (1.4.5) lib/rack/conditionalget.rb:35:incall' actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:in call' actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:incall' actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:242:in call' rack (1.4.5) lib/rack/session/abstract/id.rb:210:incontext' rack (1.4.5) lib/rack/session/abstract/id.rb:205:in call' actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:341:incall' activerecord (3.2.13) lib/active_record/query_cache.rb:64:in call' activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:incall' actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in call' activesupport (3.2.13) lib/active_support/callbacks.rb:405:in_run230975519call4callbacks' activesupport (3.2.13) lib/active_support/callbacks.rb:405:in send' activesupport (3.2.13) lib/active_support/callbacks.rb:405:inrun_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:insend' activesupport (3.2.13) lib/active_support/callbacks.rb:81:in run_callbacks' actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:incall' actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in call' actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:incall' actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in call' railties (3.2.13) lib/rails/rack/logger.rb:32:incall_app' railties (3.2.13) lib/rails/rack/logger.rb:16:in call' activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:intagged' railties (3.2.13) lib/rails/rack/logger.rb:16:in call' actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:incall' rack (1.4.5) lib/rack/methodoverride.rb:21:in call' rack (1.4.5) lib/rack/runtime.rb:17:incall' activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in call' rack (1.4.5) lib/rack/lock.rb:15:incall' actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in call' rack-cache (1.2) lib/rack/cache/context.rb:136:inforward' rack-cache (1.2) lib/rack/cache/context.rb:143:in pass' rack-cache (1.2) lib/rack/cache/context.rb:155:ininvalidate' rack-cache (1.2) lib/rack/cache/context.rb:71:in call!' rack-cache (1.2) lib/rack/cache/context.rb:51:incall' railties (3.2.13) lib/rails/engine.rb:479:in call' railties (3.2.13) lib/rails/application.rb:223:incall' railties (3.2.13) lib/rails/railtie/configurable.rb:30:in send' railties (3.2.13) lib/rails/railtie/configurable.rb:30:inmethod_missing' /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:97:in process_request' /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:520:inaccept_and_process_next_request' /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:274:in main_loop' /usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:321:instart_request_handler' /usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:275:in send' /usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:275:inhandle_spawn_application' /usr/lib/ruby/1.8/phusion_passenger/utils.rb:470:in safe_fork' /usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:270:inhandle_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:in server_main_loop' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:206:instart_synchronously' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:180:in start' /usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:149:instart' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:219:in spawn_rails_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:132:inlookup_or_add' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:214:in spawn_rails_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:82:insynchronize' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in synchronize' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:213:inspawn_rails_application' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:132:in spawn_application' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:275:inhandle_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:instart_synchronously' /usr/share/phusion-passenger/helper-scripts/passenger-spawn-server:99

tatsus commented 10 years ago

Is encode correct? Please check.

josephmarlin commented 10 years ago

Is what encoding correct? The encoding on the imported CSV file?

jforeman commented 10 years ago

I'm getting the same exact issue on 2.3.1. I'm even using your included sample files in test/samples.

hrambo commented 10 years ago

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?

aner-perez commented 10 years ago

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.

aner-perez commented 10 years ago

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
zh commented 10 years ago

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