)]}'
{"horizon/notifications.py":[{"author":{"_account_id":12281,"name":"Itxaka","email":"igarcia@suse.com","username":"itxaka"},"change_message_id":"ed9b042092ace7af1871ac776e5c1b804235298e","unresolved":false,"context_lines":[{"line_number":45,"context_line":"        self._data \u003d \u0027\u0027"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"        self.failed \u003d False"},{"line_number":48,"context_line":"        self.fail_silently \u003d fail_silently"},{"line_number":49,"context_line":"        self.message \u003d \u0027\u0027"},{"line_number":50,"context_line":"        self.level \u003d self.INFO"},{"line_number":51,"context_line":"        self.level_name \u003d \u0027info\u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a740942_050a0f8a","line":48,"updated":"2015-12-09 09:43:06.000000000","message":"Can\u0027t configure this?","commit_id":"30910d31c5c4d7b134379d35792f6b2cdc79a97d"},{"author":{"_account_id":1941,"name":"Lin Hua Cheng","email":"os.lcheng@gmail.com","username":"lin-hua-cheng"},"change_message_id":"ac31d9a73e8df060db3d7df62c93072d4e6230ab","unresolved":false,"context_lines":[{"line_number":45,"context_line":"        self._data \u003d \u0027\u0027"},{"line_number":46,"context_line":""},{"line_number":47,"context_line":"        self.failed \u003d False"},{"line_number":48,"context_line":"        self.fail_silently \u003d fail_silently"},{"line_number":49,"context_line":"        self.message \u003d \u0027\u0027"},{"line_number":50,"context_line":"        self.level \u003d self.INFO"},{"line_number":51,"context_line":"        self.level_name \u003d \u0027info\u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a740942_f468d3f6","line":48,"in_reply_to":"7a740942_050a0f8a","updated":"2015-12-09 12:02:11.000000000","message":"The message error should not stop horizon from loading and should just log a warning.\n\nI exposed the fail_silently argument in case I want to re-use this class later for some other purpose.\n\nas much as possible I like to avoid adding more configuration. Pick what makes sense and make that as the behavior.","commit_id":"30910d31c5c4d7b134379d35792f6b2cdc79a97d"},{"author":{"_account_id":12281,"name":"Itxaka","email":"igarcia@suse.com","username":"itxaka"},"change_message_id":"ed9b042092ace7af1871ac776e5c1b804235298e","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        try:"},{"line_number":60,"context_line":"            data \u003d self._data.decode(\u0027utf-8\u0027)"},{"line_number":61,"context_line":"            attrs \u003d json.loads(data)"},{"line_number":62,"context_line":"        except ValueError as exc:"},{"line_number":63,"context_line":"            self.failed \u003d True"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"            if not self.fail_silently:"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a740942_45525736","line":62,"updated":"2015-12-09 09:43:06.000000000","message":"Shouldn\u0027t it catch a lot more of errors?\n\nFor example, if I point it to /dev (dont ask :D) I get a IOError 22. If you point it to a dir with no permissions, you get an OSError 13.","commit_id":"30910d31c5c4d7b134379d35792f6b2cdc79a97d"},{"author":{"_account_id":1941,"name":"Lin Hua Cheng","email":"os.lcheng@gmail.com","username":"lin-hua-cheng"},"change_message_id":"ac31d9a73e8df060db3d7df62c93072d4e6230ab","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        try:"},{"line_number":60,"context_line":"            data \u003d self._data.decode(\u0027utf-8\u0027)"},{"line_number":61,"context_line":"            attrs \u003d json.loads(data)"},{"line_number":62,"context_line":"        except ValueError as exc:"},{"line_number":63,"context_line":"            self.failed \u003d True"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"            if not self.fail_silently:"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a740942_5428c799","line":62,"in_reply_to":"7a740942_45525736","updated":"2015-12-09 12:02:11.000000000","message":"good catch, will add a catch-all handler","commit_id":"30910d31c5c4d7b134379d35792f6b2cdc79a97d"},{"author":{"_account_id":12281,"name":"Itxaka","email":"igarcia@suse.com","username":"itxaka"},"change_message_id":"ed9b042092ace7af1871ac776e5c1b804235298e","unresolved":false,"context_lines":[{"line_number":101,"context_line":"    if not _is_path(messages_path):"},{"line_number":102,"context_line":"        return msgs"},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    for fname in os.listdir(messages_path):"},{"line_number":105,"context_line":"        fpath \u003d os.path.join(messages_path, fname)"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        msg \u003d JSONMessage(fpath)"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a740942_251f0bb8","line":104,"updated":"2015-12-09 09:43:06.000000000","message":"This will read anything on the dir. Shouldn\u0027t we glob for the .json files first instead of trying to open everything in the path?","commit_id":"30910d31c5c4d7b134379d35792f6b2cdc79a97d"},{"author":{"_account_id":1941,"name":"Lin Hua Cheng","email":"os.lcheng@gmail.com","username":"lin-hua-cheng"},"change_message_id":"ac31d9a73e8df060db3d7df62c93072d4e6230ab","unresolved":false,"context_lines":[{"line_number":101,"context_line":"    if not _is_path(messages_path):"},{"line_number":102,"context_line":"        return msgs"},{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    for fname in os.listdir(messages_path):"},{"line_number":105,"context_line":"        fpath \u003d os.path.join(messages_path, fname)"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        msg \u003d JSONMessage(fpath)"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a740942_0e4d4bc4","line":104,"in_reply_to":"7a740942_251f0bb8","updated":"2015-12-09 12:02:11.000000000","message":"Sure, sounds like a good idea","commit_id":"30910d31c5c4d7b134379d35792f6b2cdc79a97d"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"5a9eef987b1f2dca8f6cdd8a458e319082392f52","unresolved":false,"context_lines":[{"line_number":123,"context_line":"    messages \u003d cache.get(_MESSAGES_CACHE_KEY)"},{"line_number":124,"context_line":"    if not messages:"},{"line_number":125,"context_line":"        messages \u003d _get_processed_messages(messages_path)"},{"line_number":126,"context_line":"        cache.set(_MESSAGES_CACHE_KEY, messages, timeout\u003d900)"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    for msg in messages:"},{"line_number":129,"context_line":"        msg.send_message(request)"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a740942_b00d2d40","line":126,"updated":"2015-12-04 17:53:58.000000000","message":"Seems ok, is there a way to make this a config option instead? Or just use file/dir modification times?","commit_id":"30910d31c5c4d7b134379d35792f6b2cdc79a97d"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"e0dba5af9d8d27825148495d61b4adebbcf07f87","unresolved":false,"context_lines":[{"line_number":123,"context_line":"    messages \u003d cache.get(_MESSAGES_CACHE_KEY)"},{"line_number":124,"context_line":"    if not messages:"},{"line_number":125,"context_line":"        messages \u003d _get_processed_messages(messages_path)"},{"line_number":126,"context_line":"        cache.set(_MESSAGES_CACHE_KEY, messages, timeout\u003d900)"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    for msg in messages:"},{"line_number":129,"context_line":"        msg.send_message(request)"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a740942_fd62013d","line":126,"in_reply_to":"7a740942_2b287c85","updated":"2015-12-09 08:15:10.000000000","message":"Seems ok with me. I thought most filesystems cache this stuff in memory, so hopefully not to much load, anyways not a major concern (as of now).","commit_id":"30910d31c5c4d7b134379d35792f6b2cdc79a97d"},{"author":{"_account_id":1941,"name":"Lin Hua Cheng","email":"os.lcheng@gmail.com","username":"lin-hua-cheng"},"change_message_id":"0c2e7f8b0f32e17ddfcf274c425210c33c3d2176","unresolved":false,"context_lines":[{"line_number":123,"context_line":"    messages \u003d cache.get(_MESSAGES_CACHE_KEY)"},{"line_number":124,"context_line":"    if not messages:"},{"line_number":125,"context_line":"        messages \u003d _get_processed_messages(messages_path)"},{"line_number":126,"context_line":"        cache.set(_MESSAGES_CACHE_KEY, messages, timeout\u003d900)"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    for msg in messages:"},{"line_number":129,"context_line":"        msg.send_message(request)"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a740942_2b287c85","line":126,"in_reply_to":"7a740942_b00d2d40","updated":"2015-12-08 10:14:02.000000000","message":"going to make this configurable in the next patch.\n\nI like to avoid checking the modification time everytime a user logins since this will be a heavy load on prod system.  Maybe timeout option + dir modification time?","commit_id":"30910d31c5c4d7b134379d35792f6b2cdc79a97d"},{"author":{"_account_id":1941,"name":"Lin Hua Cheng","email":"os.lcheng@gmail.com","username":"lin-hua-cheng"},"change_message_id":"ac31d9a73e8df060db3d7df62c93072d4e6230ab","unresolved":false,"context_lines":[{"line_number":123,"context_line":"    messages \u003d cache.get(_MESSAGES_CACHE_KEY)"},{"line_number":124,"context_line":"    if not messages:"},{"line_number":125,"context_line":"        messages \u003d _get_processed_messages(messages_path)"},{"line_number":126,"context_line":"        cache.set(_MESSAGES_CACHE_KEY, messages, timeout\u003d900)"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    for msg in messages:"},{"line_number":129,"context_line":"        msg.send_message(request)"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a740942_f43450fc","line":126,"in_reply_to":"7a740942_fd62013d","updated":"2015-12-09 12:02:11.000000000","message":"ah! will make it simpler to just check dir modification time.","commit_id":"30910d31c5c4d7b134379d35792f6b2cdc79a97d"},{"author":{"_account_id":17172,"name":"Kenji Ishii","email":"ken-ishii@sx.jp.nec.com","username":"kenji-ishii"},"change_message_id":"bc0a919f43067fbea7ffdaffee90176eaadd7343","unresolved":false,"context_lines":[{"line_number":114,"context_line":"    msgs \u003d list()"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    if not _is_path(messages_path):"},{"line_number":117,"context_line":"        return msgs"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    # Get all files from messages_path with .json extension"},{"line_number":120,"context_line":"    for fname in glob.glob(os.path.join(messages_path, \u0027*.json\u0027)):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_6012afb6","line":117,"updated":"2016-01-21 02:36:57.000000000","message":"Do we need to output to log message ? If I specify invalid path, it seems like that I will not be able to know what is wrong.","commit_id":"38b0eb264708a83dba6d1bb878350cd393aa6937"},{"author":{"_account_id":1941,"name":"Lin Hua Cheng","email":"os.lcheng@gmail.com","username":"lin-hua-cheng"},"change_message_id":"1c12bf96db15766940ee80e8a221e005d29126b1","unresolved":false,"context_lines":[{"line_number":114,"context_line":"    msgs \u003d list()"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    if not _is_path(messages_path):"},{"line_number":117,"context_line":"        return msgs"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    # Get all files from messages_path with .json extension"},{"line_number":120,"context_line":"    for fname in glob.glob(os.path.join(messages_path, \u0027*.json\u0027)):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_28ed10ef","line":117,"in_reply_to":"9a68dd71_6012afb6","updated":"2016-01-22 19:35:43.000000000","message":"good catch! Yes this should log an error.","commit_id":"38b0eb264708a83dba6d1bb878350cd393aa6937"},{"author":{"_account_id":4264,"name":"Matthias Runge","email":"mrunge@redhat.com","username":"mrunge"},"change_message_id":"6912822164e6d65bfc687c7dd1b93d44220e7d02","unresolved":false,"context_lines":[{"line_number":131,"context_line":""},{"line_number":132,"context_line":"def process_message_notification(request, messages_path):"},{"line_number":133,"context_line":"    \"\"\"Process all the msg file found in the message directory\"\"\""},{"line_number":134,"context_line":"    if not messages_path:"},{"line_number":135,"context_line":"        return"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"    global _MESSAGES_CACHE"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_2f6edb2f","line":134,"updated":"2016-01-21 08:01:32.000000000","message":"or not _is_path(messages_path)","commit_id":"38b0eb264708a83dba6d1bb878350cd393aa6937"},{"author":{"_account_id":1941,"name":"Lin Hua Cheng","email":"os.lcheng@gmail.com","username":"lin-hua-cheng"},"change_message_id":"1c12bf96db15766940ee80e8a221e005d29126b1","unresolved":false,"context_lines":[{"line_number":131,"context_line":""},{"line_number":132,"context_line":"def process_message_notification(request, messages_path):"},{"line_number":133,"context_line":"    \"\"\"Process all the msg file found in the message directory\"\"\""},{"line_number":134,"context_line":"    if not messages_path:"},{"line_number":135,"context_line":"        return"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"    global _MESSAGES_CACHE"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_c8d5541c","line":134,"in_reply_to":"9a68dd71_2f6edb2f","updated":"2016-01-22 19:35:43.000000000","message":"The check is also done on _get_processed_messages() line 116.\n\nI move that check to later part of the code because I thought I don\u0027t want to do a path check every time the user logs on. \n\nOnce the messages are loaded to the cache, reading the path would be just an overhead I think.\n\nLet me know if you feel strongly about this.","commit_id":"38b0eb264708a83dba6d1bb878350cd393aa6937"}]}
