{"action":"created","issue":{"url":"https://api.github.com/repos/tategakibunko/jingoo/issues/23","repository_url":"https://api.github.com/repos/tategakibunko/jingoo","labels_url":"https://api.github.com/repos/tategakibunko/jingoo/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/tategakibunko/jingoo/issues/23/comments","events_url":"https://api.github.com/repos/tategakibunko/jingoo/issues/23/events","html_url":"https://github.com/tategakibunko/jingoo/issues/23","id":245055535,"node_id":"MDU6SXNzdWUyNDUwNTU1MzU=","number":23,"title":"{% for a in b %} throws exception if b doesn't exist","user":{"login":"pvaibhav","id":234072,"node_id":"MDQ6VXNlcjIzNDA3Mg==","avatar_url":"https://avatars1.githubusercontent.com/u/234072?v=4","gravatar_id":"","url":"https://api.github.com/users/pvaibhav","html_url":"https://github.com/pvaibhav","followers_url":"https://api.github.com/users/pvaibhav/followers","following_url":"https://api.github.com/users/pvaibhav/following{/other_user}","gists_url":"https://api.github.com/users/pvaibhav/gists{/gist_id}","starred_url":"https://api.github.com/users/pvaibhav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pvaibhav/subscriptions","organizations_url":"https://api.github.com/users/pvaibhav/orgs","repos_url":"https://api.github.com/users/pvaibhav/repos","events_url":"https://api.github.com/users/pvaibhav/events{/privacy}","received_events_url":"https://api.github.com/users/pvaibhav/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-07-24T11:51:43Z","updated_at":"2018-07-12T07:02:43Z","closed_at":null,"author_association":"NONE","body":"**Problem:** When using a `{% for .. %}` loop, if the object being looped-over doesn't exist, an exception is thrown: `Exception: Failure \"jg_iter:not iterable object\".`\r\nExample:\r\n```\r\n{% for p in m.params %}\r\n  {{ p }}\r\n{% endfor %}\r\n```\r\nHere if `m` does not have a `params` member, the exception is thrown.\r\n\r\n**Expected output:** The loop should be silently ignored (i.e. treat `m.params` as empty list). This is how Nunjucks (jinja port for node.js) works.\r\n\r\n**Rationale:** Due to this bug every single for loop must check that the object exists (and is iterable - not even sure how to check that!):\r\n```\r\n{% if m.params %}\r\n  {% for p in m.params %}\r\n    {{ p }}\r\n  {% endfor %}\r\n{% endif %}\r\n```\r\nThis adds needless boilerplate to all templates and also deviates from other implementations' behaviour."},"comment":{"url":"https://api.github.com/repos/tategakibunko/jingoo/issues/comments/404410597","html_url":"https://github.com/tategakibunko/jingoo/issues/23#issuecomment-404410597","issue_url":"https://api.github.com/repos/tategakibunko/jingoo/issues/23","id":404410597,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDQxMDU5Nw==","user":{"login":"sagotch","id":1826552,"node_id":"MDQ6VXNlcjE4MjY1NTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1826552?v=4","gravatar_id":"","url":"https://api.github.com/users/sagotch","html_url":"https://github.com/sagotch","followers_url":"https://api.github.com/users/sagotch/followers","following_url":"https://api.github.com/users/sagotch/following{/other_user}","gists_url":"https://api.github.com/users/sagotch/gists{/gist_id}","starred_url":"https://api.github.com/users/sagotch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sagotch/subscriptions","organizations_url":"https://api.github.com/users/sagotch/orgs","repos_url":"https://api.github.com/users/sagotch/repos","events_url":"https://api.github.com/users/sagotch/events{/privacy}","received_events_url":"https://api.github.com/users/sagotch/received_events","type":"User","site_admin":false},"created_at":"2018-07-12T07:02:43Z","updated_at":"2018-07-12T07:02:43Z","author_association":"NONE","body":"A `environment` parameter would work perfectly indeed."}}
{"actor":{"display_login":"sagotch"}}