{"action":"created","comment":{"url":"https://api.github.com/repos/flavour/eden/pulls/comments/22574207","id":22574207,"diff_hunk":"@@ -1123,6 +1125,111 @@ def custom_prep(r):\n     settings.customise_pr_contact_controller = customise_pr_contact_controller\n \n     # -----------------------------------------------------------------------------\n+    def custom_render(resource, data, meta_data, format=None):\n+        \"\"\"\n+            Custom Method to pre-render the contents for the message template\n+\n+            @param resource: the S3Resource\n+            @param data: the data returned from S3Resource.select\n+            @param meta_data: the meta data for the notification\n+            @param format: the contents format (\"text\" or \"html\")\n+        \"\"\"\n+        rows = data[\"rows\"]\n+ \n+        if format == \"text\":\n+            \n+            created_on_selector = resource.prefix_selector(\"created_on\")\n+            created_on_colname = None\n+            as_utc = current.xml.as_utc\n+            notify_on = meta_data[\"notify_on\"]\n+            last_check_time = meta_data[\"last_check_time\"]\n+            rfields = data[\"rfields\"]\n+            output = {}\n+            new, upd = [], [] \n+            \n+            # Standard text format\n+            labels = []\n+            append = labels.append\n+\n+            for rfield in rfields:\n+                if rfield.selector == created_on_selector:","path":"modules/templates/SSF/config.py","position":69,"original_position":69,"commit_id":"e7838dc10363347300a4e804cf16cb08d3ae6934","original_commit_id":"e7838dc10363347300a4e804cf16cb08d3ae6934","user":{"login":"nursix","id":1257183,"avatar_url":"https://avatars.githubusercontent.com/u/1257183?v=3","gravatar_id":"","url":"https://api.github.com/users/nursix","html_url":"https://github.com/nursix","followers_url":"https://api.github.com/users/nursix/followers","following_url":"https://api.github.com/users/nursix/following{/other_user}","gists_url":"https://api.github.com/users/nursix/gists{/gist_id}","starred_url":"https://api.github.com/users/nursix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nursix/subscriptions","organizations_url":"https://api.github.com/users/nursix/orgs","repos_url":"https://api.github.com/users/nursix/repos","events_url":"https://api.github.com/users/nursix/events{/privacy}","received_events_url":"https://api.github.com/users/nursix/received_events","type":"User","site_admin":false},"body":"I see that created_on_colname is used as a flag for whether the created_on field is among the rfields, so that this doesn't need to be checked for every row separately. I think this idea is good in general - but it isn't too obvious and has a bit of efficiency side-effects (especially since it loops over all the fields).\r\n\r\nYou could do it like this instead:\r\n\r\n    created_on_colname = \"%s.created_on\" % resource.tablename\r\n    has_created_on = any(rfield.colname == created_on_colname for rfield in rfields)\r\n\r\n...and then use:\r\n\r\n    if has_created_on:\r\n\r\ninstead. That makes it a bit more obvious - and it exits early yet provides the flag this needs. Then have the inner loop like:\r\n\r\n    for rfield in rfields:\r\n        if rfield.colname != created_on_colname:\r\n            append_column(rfield.label, row[rfield.colname])\r\n\r\n","created_at":"2015-01-07T07:50:43Z","updated_at":"2015-01-07T07:50:43Z","html_url":"https://github.com/flavour/eden/pull/1026#discussion_r22574207","pull_request_url":"https://api.github.com/repos/flavour/eden/pulls/1026","_links":{"self":{"href":"https://api.github.com/repos/flavour/eden/pulls/comments/22574207"},"html":{"href":"https://github.com/flavour/eden/pull/1026#discussion_r22574207"},"pull_request":{"href":"https://api.github.com/repos/flavour/eden/pulls/1026"}}},"pull_request":{"url":"https://api.github.com/repos/flavour/eden/pulls/1026","id":26916732,"html_url":"https://github.com/flavour/eden/pull/1026","diff_url":"https://github.com/flavour/eden/pull/1026.diff","patch_url":"https://github.com/flavour/eden/pull/1026.patch","issue_url":"https://api.github.com/repos/flavour/eden/issues/1026","number":1026,"state":"open","locked":false,"title":"Subscriptions config","user":{"login":"hitesh96db","id":6831827,"avatar_url":"https://avatars.githubusercontent.com/u/6831827?v=3","gravatar_id":"","url":"https://api.github.com/users/hitesh96db","html_url":"https://github.com/hitesh96db","followers_url":"https://api.github.com/users/hitesh96db/followers","following_url":"https://api.github.com/users/hitesh96db/following{/other_user}","gists_url":"https://api.github.com/users/hitesh96db/gists{/gist_id}","starred_url":"https://api.github.com/users/hitesh96db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hitesh96db/subscriptions","organizations_url":"https://api.github.com/users/hitesh96db/orgs","repos_url":"https://api.github.com/users/hitesh96db/repos","events_url":"https://api.github.com/users/hitesh96db/events{/privacy}","received_events_url":"https://api.github.com/users/hitesh96db/received_events","type":"User","site_admin":false},"body":"Allow users to change the Subscription settings, i.e, frequency and e-mail format.","created_at":"2015-01-06T20:48:23Z","updated_at":"2015-01-07T07:50:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3c30dc991bfaf9161ca190a97abbc466c1da44c2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/flavour/eden/pulls/1026/commits","review_comments_url":"https://api.github.com/repos/flavour/eden/pulls/1026/comments","review_comment_url":"https://api.github.com/repos/flavour/eden/pulls/comments/{number}","comments_url":"https://api.github.com/repos/flavour/eden/issues/1026/comments","statuses_url":"https://api.github.com/repos/flavour/eden/statuses/e7838dc10363347300a4e804cf16cb08d3ae6934","head":{"label":"hitesh96db:subs","ref":"subs","sha":"e7838dc10363347300a4e804cf16cb08d3ae6934","user":{"login":"hitesh96db","id":6831827,"avatar_url":"https://avatars.githubusercontent.com/u/6831827?v=3","gravatar_id":"","url":"https://api.github.com/users/hitesh96db","html_url":"https://github.com/hitesh96db","followers_url":"https://api.github.com/users/hitesh96db/followers","following_url":"https://api.github.com/users/hitesh96db/following{/other_user}","gists_url":"https://api.github.com/users/hitesh96db/gists{/gist_id}","starred_url":"https://api.github.com/users/hitesh96db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hitesh96db/subscriptions","organizations_url":"https://api.github.com/users/hitesh96db/orgs","repos_url":"https://api.github.com/users/hitesh96db/repos","events_url":"https://api.github.com/users/hitesh96db/events{/privacy}","received_events_url":"https://api.github.com/users/hitesh96db/received_events","type":"User","site_admin":false},"repo":{"id":21201750,"name":"eden","full_name":"hitesh96db/eden","owner":{"login":"hitesh96db","id":6831827,"avatar_url":"https://avatars.githubusercontent.com/u/6831827?v=3","gravatar_id":"","url":"https://api.github.com/users/hitesh96db","html_url":"https://github.com/hitesh96db","followers_url":"https://api.github.com/users/hitesh96db/followers","following_url":"https://api.github.com/users/hitesh96db/following{/other_user}","gists_url":"https://api.github.com/users/hitesh96db/gists{/gist_id}","starred_url":"https://api.github.com/users/hitesh96db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hitesh96db/subscriptions","organizations_url":"https://api.github.com/users/hitesh96db/orgs","repos_url":"https://api.github.com/users/hitesh96db/repos","events_url":"https://api.github.com/users/hitesh96db/events{/privacy}","received_events_url":"https://api.github.com/users/hitesh96db/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hitesh96db/eden","description":"Sahana Eden is an Open Source Humanitarian Platform which can be used to provide solutions for Disaster Management, Development, and Environmental Management sectors.. Please sign CLA when submitting pull requests: http://bit.ly/SSF-eCLA","fork":true,"url":"https://api.github.com/repos/hitesh96db/eden","forks_url":"https://api.github.com/repos/hitesh96db/eden/forks","keys_url":"https://api.github.com/repos/hitesh96db/eden/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hitesh96db/eden/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hitesh96db/eden/teams","hooks_url":"https://api.github.com/repos/hitesh96db/eden/hooks","issue_events_url":"https://api.github.com/repos/hitesh96db/eden/issues/events{/number}","events_url":"https://api.github.com/repos/hitesh96db/eden/events","assignees_url":"https://api.github.com/repos/hitesh96db/eden/assignees{/user}","branches_url":"https://api.github.com/repos/hitesh96db/eden/branches{/branch}","tags_url":"https://api.github.com/repos/hitesh96db/eden/tags","blobs_url":"https://api.github.com/repos/hitesh96db/eden/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hitesh96db/eden/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hitesh96db/eden/git/refs{/sha}","trees_url":"https://api.github.com/repos/hitesh96db/eden/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hitesh96db/eden/statuses/{sha}","languages_url":"https://api.github.com/repos/hitesh96db/eden/languages","stargazers_url":"https://api.github.com/repos/hitesh96db/eden/stargazers","contributors_url":"https://api.github.com/repos/hitesh96db/eden/contributors","subscribers_url":"https://api.github.com/repos/hitesh96db/eden/subscribers","subscription_url":"https://api.github.com/repos/hitesh96db/eden/subscription","commits_url":"https://api.github.com/repos/hitesh96db/eden/commits{/sha}","git_commits_url":"https://api.github.com/repos/hitesh96db/eden/git/commits{/sha}","comments_url":"https://api.github.com/repos/hitesh96db/eden/comments{/number}","issue_comment_url":"https://api.github.com/repos/hitesh96db/eden/issues/comments/{number}","contents_url":"https://api.github.com/repos/hitesh96db/eden/contents/{+path}","compare_url":"https://api.github.com/repos/hitesh96db/eden/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hitesh96db/eden/merges","archive_url":"https://api.github.com/repos/hitesh96db/eden/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hitesh96db/eden/downloads","issues_url":"https://api.github.com/repos/hitesh96db/eden/issues{/number}","pulls_url":"https://api.github.com/repos/hitesh96db/eden/pulls{/number}","milestones_url":"https://api.github.com/repos/hitesh96db/eden/milestones{/number}","notifications_url":"https://api.github.com/repos/hitesh96db/eden/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hitesh96db/eden/labels{/name}","releases_url":"https://api.github.com/repos/hitesh96db/eden/releases{/id}","created_at":"2014-06-25T12:04:48Z","updated_at":"2014-06-24T16:38:42Z","pushed_at":"2015-01-06T20:45:27Z","git_url":"git://github.com/hitesh96db/eden.git","ssh_url":"git@github.com:hitesh96db/eden.git","clone_url":"https://github.com/hitesh96db/eden.git","svn_url":"https://github.com/hitesh96db/eden","homepage":"http://eden.sahanafoundation.org","size":129884,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"flavour:master","ref":"master","sha":"d7eef703299209cec3ab94c7c98687729de717eb","user":{"login":"flavour","id":389592,"avatar_url":"https://avatars.githubusercontent.com/u/389592?v=3","gravatar_id":"","url":"https://api.github.com/users/flavour","html_url":"https://github.com/flavour","followers_url":"https://api.github.com/users/flavour/followers","following_url":"https://api.github.com/users/flavour/following{/other_user}","gists_url":"https://api.github.com/users/flavour/gists{/gist_id}","starred_url":"https://api.github.com/users/flavour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flavour/subscriptions","organizations_url":"https://api.github.com/users/flavour/orgs","repos_url":"https://api.github.com/users/flavour/repos","events_url":"https://api.github.com/users/flavour/events{/privacy}","received_events_url":"https://api.github.com/users/flavour/received_events","type":"User","site_admin":false},"repo":{"id":3021325,"name":"eden","full_name":"flavour/eden","owner":{"login":"flavour","id":389592,"avatar_url":"https://avatars.githubusercontent.com/u/389592?v=3","gravatar_id":"","url":"https://api.github.com/users/flavour","html_url":"https://github.com/flavour","followers_url":"https://api.github.com/users/flavour/followers","following_url":"https://api.github.com/users/flavour/following{/other_user}","gists_url":"https://api.github.com/users/flavour/gists{/gist_id}","starred_url":"https://api.github.com/users/flavour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flavour/subscriptions","organizations_url":"https://api.github.com/users/flavour/orgs","repos_url":"https://api.github.com/users/flavour/repos","events_url":"https://api.github.com/users/flavour/events{/privacy}","received_events_url":"https://api.github.com/users/flavour/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flavour/eden","description":"Sahana Eden is an Open Source Humanitarian Platform which can be used to provide solutions for Disaster Management, Development, and Environmental Management sectors.. Please sign CLA when submitting pull requests: http://bit.ly/SSF-eCLA","fork":false,"url":"https://api.github.com/repos/flavour/eden","forks_url":"https://api.github.com/repos/flavour/eden/forks","keys_url":"https://api.github.com/repos/flavour/eden/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flavour/eden/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flavour/eden/teams","hooks_url":"https://api.github.com/repos/flavour/eden/hooks","issue_events_url":"https://api.github.com/repos/flavour/eden/issues/events{/number}","events_url":"https://api.github.com/repos/flavour/eden/events","assignees_url":"https://api.github.com/repos/flavour/eden/assignees{/user}","branches_url":"https://api.github.com/repos/flavour/eden/branches{/branch}","tags_url":"https://api.github.com/repos/flavour/eden/tags","blobs_url":"https://api.github.com/repos/flavour/eden/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flavour/eden/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flavour/eden/git/refs{/sha}","trees_url":"https://api.github.com/repos/flavour/eden/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flavour/eden/statuses/{sha}","languages_url":"https://api.github.com/repos/flavour/eden/languages","stargazers_url":"https://api.github.com/repos/flavour/eden/stargazers","contributors_url":"https://api.github.com/repos/flavour/eden/contributors","subscribers_url":"https://api.github.com/repos/flavour/eden/subscribers","subscription_url":"https://api.github.com/repos/flavour/eden/subscription","commits_url":"https://api.github.com/repos/flavour/eden/commits{/sha}","git_commits_url":"https://api.github.com/repos/flavour/eden/git/commits{/sha}","comments_url":"https://api.github.com/repos/flavour/eden/comments{/number}","issue_comment_url":"https://api.github.com/repos/flavour/eden/issues/comments/{number}","contents_url":"https://api.github.com/repos/flavour/eden/contents/{+path}","compare_url":"https://api.github.com/repos/flavour/eden/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flavour/eden/merges","archive_url":"https://api.github.com/repos/flavour/eden/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flavour/eden/downloads","issues_url":"https://api.github.com/repos/flavour/eden/issues{/number}","pulls_url":"https://api.github.com/repos/flavour/eden/pulls{/number}","milestones_url":"https://api.github.com/repos/flavour/eden/milestones{/number}","notifications_url":"https://api.github.com/repos/flavour/eden/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flavour/eden/labels{/name}","releases_url":"https://api.github.com/repos/flavour/eden/releases{/id}","created_at":"2011-12-20T17:49:16Z","updated_at":"2015-01-06T16:37:35Z","pushed_at":"2015-01-06T16:37:34Z","git_url":"git://github.com/flavour/eden.git","ssh_url":"git@github.com:flavour/eden.git","clone_url":"https://github.com/flavour/eden.git","svn_url":"https://github.com/flavour/eden","homepage":"http://eden.sahanafoundation.org","size":167535,"stargazers_count":159,"watchers_count":159,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":377,"mirror_url":null,"open_issues_count":46,"forks":377,"open_issues":46,"watchers":159,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flavour/eden/pulls/1026"},"html":{"href":"https://github.com/flavour/eden/pull/1026"},"issue":{"href":"https://api.github.com/repos/flavour/eden/issues/1026"},"comments":{"href":"https://api.github.com/repos/flavour/eden/issues/1026/comments"},"review_comments":{"href":"https://api.github.com/repos/flavour/eden/pulls/1026/comments"},"review_comment":{"href":"https://api.github.com/repos/flavour/eden/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/flavour/eden/pulls/1026/commits"},"statuses":{"href":"https://api.github.com/repos/flavour/eden/statuses/e7838dc10363347300a4e804cf16cb08d3ae6934"}}}}