cforce/redmine_show_descriptions — Issue #2: The Plugin (breaks Rest-API
Author: cforce
Created: 2012-01-23 12:46:04+00:00
State: open

The original Plugin (0.0.4 Repack) breaks Rest-API. If installed its mo more usable. See issue http://www.redmine.org/issues/8883
It seems that the cause is code in redmine_show_descriptions/app/views/issues/index.rhtml.
The plugin is using hooks and partial rendering of templates, which templates are searched at the wrong place. Means that its searches them in path of other plugins first (or only) instead of core views, which results that there is no view representation renderable for REST/XML Mimetype (view.erb but only view.html.erb is found)

There are two lines in code which cause the problems that cause errors in rest api, e.g calling http://myredminesrv.org/issues.xml woN't return xml but Internal error 500 (ActionView::TemplateError (Missing template ...)

* view_issues_index_bottom
line 69:

<%= call_hook(:view_issues_index_bottom, { :issues => @issues, :project => @project, :query => @query }) %>
)

causes following error ..

F, [2011-12-13T14:39:04.542091 #23568] FATAL -- :
ActionView::TemplateError (Missing template hooks/redmine_spent_time_column/_view_issues_index_bottom.erb in view path vendor/plugins/projects_tree_view/app/views:vendor/plugins/question_plugin/app/views:vendor/plugins/redmics/app/views:vendor/plugins/redmine-system-notification-plugin/app/views:vendor/plugins/redmine_assets_plugin/app/views:vendor/plugins/redmine_blocks_layout/app/views:vendor/plugins/redmine_boards_watchers/app/views:vendor/plugins/redmine_cc_addresses/app/views:vendor/plugins/redmine_charts/app/views:vendor/plugins/redmine_checkout/app/views:vendor/plugins/redmine_code_review/app/views:vendor/plugins/redmine_digest/app/views:vendor/plugins/redmine_favourite_projects/app/views:vendor/plugins/redmine_goyello_stuff_to_do/app/views:vendor/plugins/redmine_graphs/app/views:vendor/plugins/redmine_hudson/app/views:vendor/plugins/redmine_importer/app/views:vendor/plugins/redmine_issue_history/app/views:vendor/plugins/redmine_last_messages/app/views:vendor/plugins/redmine_ldap_sync/app/views:vendor/plugins/redmine_lightbox/app/views:vendor/plugins/redmine_loader/app/views:vendor/plugins/redmine_local_avatars/app/views:vendor/plugins/redmine_logs/app/views:vendor/plugins/redmine_meetings/app/views:vendor/plugins/redmine_my_widgets/app/views:vendor/plugins/redmine_mylyn_connector/app/views:vendor/plugins/redmine_opensearch/app/views:vendor/plugins/redmine_pastebin/app/views:vendor/plugins/redmine_polls/app/views:vendor/plugins/redmine_screenshot_paste/app/views:vendor/plugins/redmine_scrumdashboard/app/views:vendor/plugins/redmine_show_descriptions/app/views:vendor/plugins/redmine_tags/app/views:vendor/plugins/redmine_thumbnails/app/views:vendor/plugins/redmine_time_tracker/app/views:vendor/plugins/redmine_user_status/app/views:vendor/plugins/redmine_vote/app/views:vendor/plugins/redmine_webdav/app/views:vendor/plugins/redmine_wiki_extensions/app/views:vendor/plugins/redmine_workflow_viz/app/views:vendor/plugins/redmine_xapian/app/views:vendor/plugins/redmine_xls_export/app/views:vendor/plugins/redmine_spent_time_column/app/views:app/views) on line #68 of vendor/plugins/redmine_show_descriptions/app/views/issues/index.rhtml:
65: <% end %>
66:
67: <% end %>
68: <%= call_hook(:view_issues_index_bottom, { :issues => @issues, :project => @project, :query => @query }) %>
69:
70: <% content_for :sidebar do %>
71: <%= render :partial => 'issues/sidebar' %>

lib/redmine/hook.rb:113:in `send'
lib/redmine/hook.rb:113:in `view_issues_index_bottom'
lib/redmine/hook.rb:63:in `send'
lib/redmine/hook.rb:63:in `call_hook'
lib/redmine/hook.rb:63:in `each'
lib/redmine/hook.rb:63:in `call_hook'
lib/redmine/hook.rb:60:in `tap'
lib/redmine/hook.rb:60:in `call_hook'
lib/redmine/hook.rb:144:in `call_hook'
vendor/plugins/redmine_show_descriptions/app/views/issues/index.rhtml:68:in `_run_rhtml_vendor47plugins47redmine_show_descriptions47app47views47issues47index46rhtml'
app/controllers/issues_controller.rb:91:in `index_without_xls_export'
passenger (3.0.8) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
passenger (3.0.8) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
passenger (3.0.8) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
passenger (3.0.8) lib/phusion_passenger/utils.rb:479:in `safe_fork'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:180:in `start'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
passenger (3.0.8) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
passenger (3.0.8) lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
passenger (3.0.8) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.8) helper-scripts/passenger-spawn-server:99

I, [2011-12-13T14:39:04.542547 #23568] INFO -- : Rendering /opt/redmine-1.2.1d3/public/500.html (500 Internal Server Error)

I copied redmine /vendor/plugins/redmine_spent_time_column/app/views/hooks/redmine_spent_time_column/_view_issues_index_bottom.html.erb to _view_issues_index_bottom.erb and the error was gone.

Then the next line made a problem..

* render :partial => 'issues/sidebar'

line 70

<% content_for :sidebar do %>
<%= render :partial => 'issues/sidebar' %>
<% end %>

ActionView::TemplateError (Missing template issues/_tags_sidebar.erb in view path vendor/plugins/projects_tree_view/app/views:vendor/plugins/question_plugin/app/views:vendor/plugins/redmics/app/views:vendor/plugins/redmine-system-notification-plugin/app/views:vendor/plugins/redmine_assets_plugin/app/views:vendor/plugins/redmine_blocks_layout/app/views:vendor/plugins/redmine_boards_watchers/app/views:vendor/plugins/redmine_cc_addresses/app/views:vendor/plugins/redmine_charts/app/views:vendor/plugins/redmine_checkout/app/views:vendor/plugins/redmine_code_review/app/views:vendor/plugins/redmine_digest/app/views:vendor/plugins/redmine_favourite_projects/app/views:vendor/plugins/redmine_goyello_stuff_to_do/app/views:vendor/plugins/redmine_graphs/app/views:vendor/plugins/redmine_hudson/app/views:vendor/plugins/redmine_importer/app/views:vendor/plugins/redmine_issue_history/app/views:vendor/plugins/redmine_last_messages/app/views:vendor/plugins/redmine_ldap_sync/app/views:vendor/plugins/redmine_lightbox/app/views:vendor/plugins/redmine_loader/app/views:vendor/plugins/redmine_local_avatars/app/views:vendor/plugins/redmine_logs/app/views:vendor/plugins/redmine_meetings/app/views:vendor/plugins/redmine_my_widgets/app/views:vendor/plugins/redmine_mylyn_connector/app/views:vendor/plugins/redmine_opensearch/app/views:vendor/plugins/redmine_pastebin/app/views:vendor/plugins/redmine_polls/app/views:vendor/plugins/redmine_screenshot_paste/app/views:vendor/plugins/redmine_scrumdashboard/app/views:vendor/plugins/redmine_tags/app/views:vendor/plugins/redmine_thumbnails/app/views:vendor/plugins/redmine_time_tracker/app/views:vendor/plugins/redmine_user_status/app/views:vendor/plugins/redmine_vote/app/views:vendor/plugins/redmine_webdav/app/views:vendor/plugins/redmine_wiki_extensions/app/views:vendor/plugins/redmine_workflow_viz/app/views:vendor/plugins/redmine_xapian/app/views:vendor/plugins/redmine_xls_export/app/views:vendor/plugins/redmine_spent_time_column/app/views:vendor/plugins/redmine_show_descriptions/app/views:app/views) on line #14 of app/views/issues/_sidebar.rhtml:
11: <% if User.current.allowed_to?(:view_gantt, @project, :global => true) %>
12:	<%= link_to(l(:label_gantt), :controller => 'gantts', :action => 'show', :project_id => @project) %>

13: <% end %>
14: <%= call_hook(:view_issues_sidebar_planning_bottom) %>
15:
16: <%= render_sidebar_queries %>
17: <%= call_hook(:view_issues_sidebar_queries_bottom) %>

lib/redmine/hook.rb:113:in `send'
lib/redmine/hook.rb:113:in `view_issues_sidebar_planning_bottom'
lib/redmine/hook.rb:63:in `send'
lib/redmine/hook.rb:63:in `call_hook'
lib/redmine/hook.rb:63:in `each'
lib/redmine/hook.rb:63:in `call_hook'
lib/redmine/hook.rb:60:in `tap'
lib/redmine/hook.rb:60:in `call_hook'
lib/redmine/hook.rb:144:in `call_hook'
app/views/issues/_sidebar.rhtml:14:in `_run_rhtml_app47views47issues47_sidebar46rhtml_locals_object_sidebar'
vendor/plugins/redmine_show_descriptions/app/views/issues/index.rhtml:71:in `_run_rhtml_vendor47plugins47redmine_show_descriptions47app47views47issues47index46rhtml'
app/helpers/application_helper.rb:868:in `content_for'
vendor/plugins/redmine_show_descriptions/app/views/issues/index.rhtml:70:in `_run_rhtml_vendor47plugins47redmine_show_descriptions47app47views47issues47index46rhtml'
app/controllers/issues_controller.rb:91:in `index_without_xls_export'
passenger (3.0.8) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
passenger (3.0.8) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
passenger (3.0.8) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
passenger (3.0.8) lib/phusion_passenger/utils.rb:479:in `safe_fork'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:180:in `start'
passenger (3.0.8) lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
passenger (3.0.8) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
passenger (3.0.8) lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
passenger (3.0.8) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
passenger (3.0.8) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:357:in `__send__'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.8) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.8) helper-scripts/passenger-spawn-server:99

Seems as the redmine_tags plugin redner its own sidebar and this has no representation for xml/rest.
How can a plugin in general only overide/extend rendering for html but fall back to core view rendering when xml/json is reqquested.