{"action":"created","issue":{"url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1095","labels_url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1095/labels{/name}","comments_url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1095/comments","events_url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1095/events","html_url":"https://github.com/PerlDancer/Dancer2/pull/1095","id":125754706,"number":1095,"title":"Fix/tt2 relative paths","user":{"login":"veryrusty","id":117258,"avatar_url":"https://avatars.githubusercontent.com/u/117258?v=3","gravatar_id":"","url":"https://api.github.com/users/veryrusty","html_url":"https://github.com/veryrusty","followers_url":"https://api.github.com/users/veryrusty/followers","following_url":"https://api.github.com/users/veryrusty/following{/other_user}","gists_url":"https://api.github.com/users/veryrusty/gists{/gist_id}","starred_url":"https://api.github.com/users/veryrusty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/veryrusty/subscriptions","organizations_url":"https://api.github.com/users/veryrusty/orgs","repos_url":"https://api.github.com/users/veryrusty/repos","events_url":"https://api.github.com/users/veryrusty/events{/privacy}","received_events_url":"https://api.github.com/users/veryrusty/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-09T11:57:23Z","updated_at":"2016-01-09T21:40:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/PerlDancer/Dancer2/pulls/1095","html_url":"https://github.com/PerlDancer/Dancer2/pull/1095","diff_url":"https://github.com/PerlDancer/Dancer2/pull/1095.diff","patch_url":"https://github.com/PerlDancer/Dancer2/pull/1095.patch"},"body":"Fix for the Dancer2::Template::TemplateToolkit to allow both relative `views` and the further processing of relative templates.\r\n\r\nRough summary: let TT2 use its INCLUDE_PATH searching mechanisms to do any path concatenation and tests for template existence. Without this, any 'relative' templates will not be found when using INCLUDE or PROCESS directives.\r\n\r\nReverts the code change from #1037 (but keep the tests from that PR).\r\n\r\nAdds the commits from #955 that build a dynamic INCLUDE_PATH generator for the TT2 object. \r\n\r\nAn additional configuration option is added (not in #955), allowing an extra `include_path` (note the lower case) to be prepended to the list of paths added to the INCLUDE_PATH of the TT2 object. By adding in an (absolute) path for `include_path` into, say your production environment's config should mitigate some deployment options not behaving when relative views are used (in development).\r\nNote that this isn't documented - but then again, none of the TemplateToolkit config options seem to be documents (or my search foo is lacking tonight). \r\n\r\nRefactor the test for a view or layout `pathname` existing into a new method. The default is still\r\na simple `-f $pathname` test.  D2::Template::TemplateToolkit overrides this, delegating the test to the current Template::Context. This allows\r\n  * relative paths for views, and further templates to be processed that are relative to that. (resolving #1093)\r\n  * allows the use Template::Provider classes that pull templates from other data sources (like S3 or a database).\r\n\r\nThis will also resolve #1075."},"comment":{"url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/comments/170284600","html_url":"https://github.com/PerlDancer/Dancer2/pull/1095#issuecomment-170284600","issue_url":"https://api.github.com/repos/PerlDancer/Dancer2/issues/1095","id":170284600,"user":{"login":"abeverley","id":4589486,"avatar_url":"https://avatars.githubusercontent.com/u/4589486?v=3","gravatar_id":"","url":"https://api.github.com/users/abeverley","html_url":"https://github.com/abeverley","followers_url":"https://api.github.com/users/abeverley/followers","following_url":"https://api.github.com/users/abeverley/following{/other_user}","gists_url":"https://api.github.com/users/abeverley/gists{/gist_id}","starred_url":"https://api.github.com/users/abeverley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abeverley/subscriptions","organizations_url":"https://api.github.com/users/abeverley/orgs","repos_url":"https://api.github.com/users/abeverley/repos","events_url":"https://api.github.com/users/abeverley/events{/privacy}","received_events_url":"https://api.github.com/users/abeverley/received_events","type":"User","site_admin":false},"created_at":"2016-01-09T21:40:49Z","updated_at":"2016-01-09T21:40:49Z","body":"Thanks @veryrusty, +1 from me.\r\n\r\nTests conducted:\r\n\r\n- fastcgi, no custom ```views```, ```PROCESS``` template (my use-case)\r\n- fastcgi, custom relative ```views```, ```include_path``` configured, ```PROCESS``` template\r\n- running locally on port 3000, custom relative ```views```"}}