)]}'
{"doc/source/cors.rst":[{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"a01d63798ef0891e84a4f79b69188de8aedd9761","unresolved":false,"context_lines":[{"line_number":10,"context_line":"----------"},{"line_number":11,"context_line":"First, include the middleware in your application::"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"    app \u003d cors.CORS(your_wsgi_application)"},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Secondly, add one (or more) configuration blocks to your api\u0027s configuration."},{"line_number":16,"context_line":"Note that configuration groups must be prefixed with \u0027cors.\u0027 and must be"}],"source_content_type":"text/x-rst","patch_set":1,"id":"baa041b7_5f73ceb1","line":13,"range":{"start_line":13,"start_character":14,"end_line":13,"end_character":15},"updated":"2015-04-02 20:09:37.000000000","message":"Maybe just add\n\n    from oslo_middleware import cors\n\nSo it\u0027s obvious where cors comes from?","commit_id":"12cd27f8640cdfb4fe8f3c70963eef6aae83a91a"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"c9bbbd642f0c5cafb3ee2f3b103bf46e5ee76bad","unresolved":false,"context_lines":[{"line_number":2,"context_line":"CORS Middleware"},{"line_number":3,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":4,"context_line":""},{"line_number":5,"context_line":"This Middleware provides a comprehensive, configurable implementation of the"},{"line_number":6,"context_line":"CORS_ (Cross Origin Resource Sharing) specification as oslo-supported python"},{"line_number":7,"context_line":"wsgi middleware."},{"line_number":8,"context_line":""}],"source_content_type":"text/x-rst","patch_set":13,"id":"9aa53dc9_609cabc0","line":5,"updated":"2015-04-07 21:13:58.000000000","message":"s/Middleware/middleware/","commit_id":"e314153a4902708517f344376abdb425f04c95c8"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"c9bbbd642f0c5cafb3ee2f3b103bf46e5ee76bad","unresolved":false,"context_lines":[{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Then, create an new configuration group for each domain that you\u0027d like to"},{"line_number":33,"context_line":"extend. Each of these configuration groups must be named `[cors.something]`,"},{"line_number":34,"context_line":"with each name being unique. The purpose of the suffix to `cors.` is"},{"line_number":35,"context_line":"legibility, we recommend using a reasonable human-readable string::"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    [cors.ironic_webclient]"}],"source_content_type":"text/x-rst","patch_set":13,"id":"9aa53dc9_00803f45","line":34,"updated":"2015-04-07 21:13:58.000000000","message":"s/suffix/prefix/","commit_id":"e314153a4902708517f344376abdb425f04c95c8"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"806af69f9fd728a8acbcb20d20d7a7a3e626c393","unresolved":false,"context_lines":[{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Then, create an new configuration group for each domain that you\u0027d like to"},{"line_number":33,"context_line":"extend. Each of these configuration groups must be named `[cors.something]`,"},{"line_number":34,"context_line":"with each name being unique. The purpose of the suffix to `cors.` is"},{"line_number":35,"context_line":"legibility, we recommend using a reasonable human-readable string::"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    [cors.ironic_webclient]"}],"source_content_type":"text/x-rst","patch_set":13,"id":"9aa53dc9_c3d94185","line":34,"in_reply_to":"9aa53dc9_00803f45","updated":"2015-04-07 21:29:45.000000000","message":"I\u0027m referring to the text after `cors.` such as `cors.horizon`. That\u0027s a suffix, not a prefix.","commit_id":"e314153a4902708517f344376abdb425f04c95c8"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"a3ef47f2b3a558aac863dccbf1f56ba537fa28fe","unresolved":false,"context_lines":[{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Then, create an new configuration group for each domain that you\u0027d like to"},{"line_number":33,"context_line":"extend. Each of these configuration groups must be named `[cors.something]`,"},{"line_number":34,"context_line":"with each name being unique. The purpose of the suffix to `cors.` is"},{"line_number":35,"context_line":"legibility, we recommend using a reasonable human-readable string::"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    [cors.ironic_webclient]"}],"source_content_type":"text/x-rst","patch_set":13,"id":"9aa53dc9_433531f5","line":34,"in_reply_to":"9aa53dc9_c3d94185","updated":"2015-04-07 21:41:26.000000000","message":"ah i see... i read it differently.","commit_id":"e314153a4902708517f344376abdb425f04c95c8"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"6d59db4560f547ab2da99b38a5d7606dbe7de3bb","unresolved":false,"context_lines":[{"line_number":14,"context_line":""},{"line_number":15,"context_line":"    app \u003d cors.CORS(your_wsgi_application)"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Secondly, add a global [cors] configuration block to your api\u0027s configuration::"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"    [cors]"},{"line_number":20,"context_line":"    allowed_origin\u003dhttps://website.example.com:443"}],"source_content_type":"text/x-rst","patch_set":14,"id":"9aa53dc9_0fbd0368","line":17,"updated":"2015-04-08 04:25:14.000000000","message":"Is this in the file read by oslo.config, or paste\u0027s INI file?","commit_id":"bcb2b24349cc5d13d5dd11b5f67e6b71e1b3b9f7"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"493ca518a6e0ac8a0f43a766850b5f55b9a60ce8","unresolved":false,"context_lines":[{"line_number":14,"context_line":""},{"line_number":15,"context_line":"    app \u003d cors.CORS(your_wsgi_application)"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Secondly, add a global [cors] configuration block to your api\u0027s configuration::"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"    [cors]"},{"line_number":20,"context_line":"    allowed_origin\u003dhttps://website.example.com:443"}],"source_content_type":"text/x-rst","patch_set":14,"id":"9aa53dc9_6bb103e1","line":17,"in_reply_to":"9aa53dc9_0fbd0368","updated":"2015-04-08 17:26:30.000000000","message":"You\u0027re right, it should be more explicit. This should be in the file read by oslo.config.","commit_id":"bcb2b24349cc5d13d5dd11b5f67e6b71e1b3b9f7"}],"oslo/middleware/cors.py":[{"author":{"_account_id":12000,"name":"Ian Cordasco","email":"sigmavirus24@gmail.com","username":"sigmavirus24"},"change_message_id":"a01d63798ef0891e84a4f79b69188de8aedd9761","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"baa041b7_3f97ea91","updated":"2015-04-02 20:09:37.000000000","message":"I\u0027m 99% sure that these were not going to be added for new modules/namespaces after a migration to the new namespace scheme.","commit_id":"12cd27f8640cdfb4fe8f3c70963eef6aae83a91a"}],"oslo_middleware/cors.py":[{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"fa4f09b1672948e408dd2baddd29b5468766c0ce","unresolved":false,"context_lines":[{"line_number":101,"context_line":"            for section in CONF.list_all_sections():"},{"line_number":102,"context_line":"                if section.startswith(\u0027cors.\u0027):"},{"line_number":103,"context_line":"                    self._load_cors_config(section)"},{"line_number":104,"context_line":"        except Exception:"},{"line_number":105,"context_line":"            # This makes me a little uneasy, as we\u0027re iterating over a"},{"line_number":106,"context_line":"            # private interface."},{"line_number":107,"context_line":"            # TODO(krotscheck): oslo.config\u0027s groups could be public."}],"source_content_type":"text/x-python","patch_set":9,"id":"9aa53dc9_81237105","line":104,"updated":"2015-04-06 16:42:29.000000000","message":"Can we narrow this down a little?  except Exception always makes me nervous.","commit_id":"6d0bcb141cd9577335efcbeaaafd7bb89e8ccc18"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"fa4f09b1672948e408dd2baddd29b5468766c0ce","unresolved":false,"context_lines":[{"line_number":102,"context_line":"                if section.startswith(\u0027cors.\u0027):"},{"line_number":103,"context_line":"                    self._load_cors_config(section)"},{"line_number":104,"context_line":"        except Exception:"},{"line_number":105,"context_line":"            # This makes me a little uneasy, as we\u0027re iterating over a"},{"line_number":106,"context_line":"            # private interface."},{"line_number":107,"context_line":"            # TODO(krotscheck): oslo.config\u0027s groups could be public."},{"line_number":108,"context_line":"            LOG.warn(\u0027CONF not initialized, falling back to manually\u0027"}],"source_content_type":"text/x-python","patch_set":9,"id":"9aa53dc9_414689c0","line":105,"updated":"2015-04-06 16:42:29.000000000","message":"On the plus side, this path should only be taken with older versions of oslo.config where it\u0027s unlikely the private variable will change.","commit_id":"6d0bcb141cd9577335efcbeaaafd7bb89e8ccc18"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"c9bbbd642f0c5cafb3ee2f3b103bf46e5ee76bad","unresolved":false,"context_lines":[{"line_number":27,"context_line":"CONF \u003d cfg.CONF"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"CORS_OPTS \u003d ["},{"line_number":30,"context_line":"    cfg.StrOpt(\u0027allowed_origin\u0027,"},{"line_number":31,"context_line":"               default\u003dNone,"},{"line_number":32,"context_line":"               help\u003d\u0027Indicate whether this resource may be shared with the \u0027"},{"line_number":33,"context_line":"                    \u0027domain received in the requests \"origin\" header.\u0027),"}],"source_content_type":"text/x-python","patch_set":13,"id":"9aa53dc9_20b583ed","line":30,"updated":"2015-04-07 21:13:58.000000000","message":"i think this should be MultiOpt as it says we\u0027re allowed mulitple allowed_origin\u0027s in doc","commit_id":"e314153a4902708517f344376abdb425f04c95c8"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"806af69f9fd728a8acbcb20d20d7a7a3e626c393","unresolved":false,"context_lines":[{"line_number":27,"context_line":"CONF \u003d cfg.CONF"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"CORS_OPTS \u003d ["},{"line_number":30,"context_line":"    cfg.StrOpt(\u0027allowed_origin\u0027,"},{"line_number":31,"context_line":"               default\u003dNone,"},{"line_number":32,"context_line":"               help\u003d\u0027Indicate whether this resource may be shared with the \u0027"},{"line_number":33,"context_line":"                    \u0027domain received in the requests \"origin\" header.\u0027),"}],"source_content_type":"text/x-python","patch_set":13,"id":"9aa53dc9_c3c0217f","line":30,"in_reply_to":"9aa53dc9_20b583ed","updated":"2015-04-07 21:29:45.000000000","message":"As the documentation states, for multiple allowed_origin\u0027s you have to add additional configuration blocks.","commit_id":"e314153a4902708517f344376abdb425f04c95c8"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"c9bbbd642f0c5cafb3ee2f3b103bf46e5ee76bad","unresolved":false,"context_lines":[{"line_number":119,"context_line":"        \"\"\""},{"line_number":120,"context_line":"        # There\u0027s no harm in registering a conf blog twice (In case it was"},{"line_number":121,"context_line":"        # already registered somewhere else, like in a Unit test)."},{"line_number":122,"context_line":"        CONF.register_opts(CORS_SUBGROUP_OPTS, group_name)"},{"line_number":123,"context_line":"        config \u003d CONF[group_name]"},{"line_number":124,"context_line":"        if \u0027allowed_origin\u0027 not in config or not config.allowed_origin:"},{"line_number":125,"context_line":"            LOG.warn(\u0027Config block %s does not contain \\\u0027allowed_origin\\\u0027, \u0027"}],"source_content_type":"text/x-python","patch_set":13,"id":"9aa53dc9_a31e3d61","line":122,"updated":"2015-04-07 21:13:58.000000000","message":"tbh, this seems like it\u0027d be easier to just pass in conf options from api-paste... seems sorta hacky (but just personal opinion here)","commit_id":"e314153a4902708517f344376abdb425f04c95c8"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"806af69f9fd728a8acbcb20d20d7a7a3e626c393","unresolved":false,"context_lines":[{"line_number":119,"context_line":"        \"\"\""},{"line_number":120,"context_line":"        # There\u0027s no harm in registering a conf blog twice (In case it was"},{"line_number":121,"context_line":"        # already registered somewhere else, like in a Unit test)."},{"line_number":122,"context_line":"        CONF.register_opts(CORS_SUBGROUP_OPTS, group_name)"},{"line_number":123,"context_line":"        config \u003d CONF[group_name]"},{"line_number":124,"context_line":"        if \u0027allowed_origin\u0027 not in config or not config.allowed_origin:"},{"line_number":125,"context_line":"            LOG.warn(\u0027Config block %s does not contain \\\u0027allowed_origin\\\u0027, \u0027"}],"source_content_type":"text/x-python","patch_set":13,"id":"9aa53dc9_032a892c","line":122,"in_reply_to":"9aa53dc9_a31e3d61","updated":"2015-04-07 21:29:45.000000000","message":"The reason I use subgroup here is because I need oslo.config to throw an AttributeError if I try to access an unset property. If a default value is set, this never happens. The global options hash, however _should_ have default values, because it\u0027s used as the fallback for when a subgroup fails over.","commit_id":"e314153a4902708517f344376abdb425f04c95c8"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"c9bbbd642f0c5cafb3ee2f3b103bf46e5ee76bad","unresolved":false,"context_lines":[{"line_number":203,"context_line":"        # (Section 6.2.6)"},{"line_number":204,"context_line":"        for requested_header in request_headers:"},{"line_number":205,"context_line":"            upper_header \u003d requested_header.upper()"},{"line_number":206,"context_line":"            if upper_header not in \\"},{"line_number":207,"context_line":"                    (header.upper() for header in cors_config.allow_headers) \\"},{"line_number":208,"context_line":"                    and upper_header not in self.simple_headers:"},{"line_number":209,"context_line":"                return"}],"source_content_type":"text/x-python","patch_set":13,"id":"9aa53dc9_403527f5","line":206,"updated":"2015-04-07 21:13:58.000000000","message":"use brackets instead of slashes","commit_id":"e314153a4902708517f344376abdb425f04c95c8"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"6d59db4560f547ab2da99b38a5d7606dbe7de3bb","unresolved":false,"context_lines":[{"line_number":55,"context_line":"]"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"# Register the default CORS configuration."},{"line_number":58,"context_line":"CONF.register_opts(CORS_OPTS, \u0027cors\u0027)"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"# Build an OPTS block with all the above options, but no default values."},{"line_number":61,"context_line":"CORS_SUBGROUP_OPTS \u003d []"}],"source_content_type":"text/x-python","patch_set":14,"id":"9aa53dc9_6f212fb4","line":58,"updated":"2015-04-08 04:25:14.000000000","message":"Since this is new middleware, can we pass a ConfigOpts instance to the constructor and let it call register_opts()? That eliminates the dependency on the global CONF, which should also let us get rid of the error handling below.","commit_id":"bcb2b24349cc5d13d5dd11b5f67e6b71e1b3b9f7"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"493ca518a6e0ac8a0f43a766850b5f55b9a60ce8","unresolved":false,"context_lines":[{"line_number":55,"context_line":"]"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"# Register the default CORS configuration."},{"line_number":58,"context_line":"CONF.register_opts(CORS_OPTS, \u0027cors\u0027)"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":"# Build an OPTS block with all the above options, but no default values."},{"line_number":61,"context_line":"CORS_SUBGROUP_OPTS \u003d []"}],"source_content_type":"text/x-python","patch_set":14,"id":"9aa53dc9_8b9fa7b3","line":58,"in_reply_to":"9aa53dc9_6f212fb4","updated":"2015-04-08 17:26:30.000000000","message":"I can see the use of passing the CONF object to the constructor, I can update that without an issue.","commit_id":"bcb2b24349cc5d13d5dd11b5f67e6b71e1b3b9f7"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"6d59db4560f547ab2da99b38a5d7606dbe7de3bb","unresolved":false,"context_lines":[{"line_number":61,"context_line":"CORS_SUBGROUP_OPTS \u003d []"},{"line_number":62,"context_line":"for opt in CORS_OPTS:"},{"line_number":63,"context_line":"    new_opt \u003d copy.copy(opt)"},{"line_number":64,"context_line":"    del new_opt.default"},{"line_number":65,"context_line":"    CORS_SUBGROUP_OPTS.append(new_opt)"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"9aa53dc9_8f5fd340","line":64,"updated":"2015-04-08 04:25:14.000000000","message":"I\u0027m not sure this is the safe way to do this. It might be, I\u0027m just unsure we consider deleting attributes to be the right way to \"blank\" it. We don\u0027t protect against it being unset in Opt, so I worry that if it isn\u0027t being reset it might break inside oslo.config in unexpected ways.","commit_id":"bcb2b24349cc5d13d5dd11b5f67e6b71e1b3b9f7"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"493ca518a6e0ac8a0f43a766850b5f55b9a60ce8","unresolved":false,"context_lines":[{"line_number":61,"context_line":"CORS_SUBGROUP_OPTS \u003d []"},{"line_number":62,"context_line":"for opt in CORS_OPTS:"},{"line_number":63,"context_line":"    new_opt \u003d copy.copy(opt)"},{"line_number":64,"context_line":"    del new_opt.default"},{"line_number":65,"context_line":"    CORS_SUBGROUP_OPTS.append(new_opt)"},{"line_number":66,"context_line":""},{"line_number":67,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"9aa53dc9_8bd44747","line":64,"in_reply_to":"9aa53dc9_8f5fd340","updated":"2015-04-08 17:26:30.000000000","message":"Based on this comment and the one below, it sounds like you want me to move this copy loop into the config parsing section. See below for my interpretation of what you\u0027re saying.","commit_id":"bcb2b24349cc5d13d5dd11b5f67e6b71e1b3b9f7"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"6d59db4560f547ab2da99b38a5d7606dbe7de3bb","unresolved":false,"context_lines":[{"line_number":101,"context_line":"            for section in CONF.list_all_sections():"},{"line_number":102,"context_line":"                if section.startswith(\u0027cors.\u0027):"},{"line_number":103,"context_line":"                    self._load_cors_config(section)"},{"line_number":104,"context_line":"        except AttributeError:"},{"line_number":105,"context_line":"            # This makes me a little uneasy, as we\u0027re iterating over a"},{"line_number":106,"context_line":"            # private interface."},{"line_number":107,"context_line":"            # TODO(krotscheck): oslo.config\u0027s groups could be public."}],"source_content_type":"text/x-python","patch_set":14,"id":"9aa53dc9_ef1bff7e","line":104,"updated":"2015-04-08 04:25:14.000000000","message":"We wouldn\u0027t need to do this special error handling if we didn\u0027t change the global config object implicitly and took an explicit ConfigOpts instance as argument.","commit_id":"bcb2b24349cc5d13d5dd11b5f67e6b71e1b3b9f7"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"493ca518a6e0ac8a0f43a766850b5f55b9a60ce8","unresolved":false,"context_lines":[{"line_number":101,"context_line":"            for section in CONF.list_all_sections():"},{"line_number":102,"context_line":"                if section.startswith(\u0027cors.\u0027):"},{"line_number":103,"context_line":"                    self._load_cors_config(section)"},{"line_number":104,"context_line":"        except AttributeError:"},{"line_number":105,"context_line":"            # This makes me a little uneasy, as we\u0027re iterating over a"},{"line_number":106,"context_line":"            # private interface."},{"line_number":107,"context_line":"            # TODO(krotscheck): oslo.config\u0027s groups could be public."}],"source_content_type":"text/x-python","patch_set":14,"id":"9aa53dc9_2be9bbe6","line":104,"in_reply_to":"9aa53dc9_ef1bff7e","updated":"2015-04-08 17:26:30.000000000","message":"I think I tried that, but I can double check.","commit_id":"bcb2b24349cc5d13d5dd11b5f67e6b71e1b3b9f7"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"6d59db4560f547ab2da99b38a5d7606dbe7de3bb","unresolved":false,"context_lines":[{"line_number":119,"context_line":"        \"\"\""},{"line_number":120,"context_line":"        # There\u0027s no harm in registering a conf blog twice (In case it was"},{"line_number":121,"context_line":"        # already registered somewhere else, like in a Unit test)."},{"line_number":122,"context_line":"        CONF.register_opts(CORS_SUBGROUP_OPTS, group_name)"},{"line_number":123,"context_line":"        config \u003d CONF[group_name]"},{"line_number":124,"context_line":"        if \u0027allowed_origin\u0027 not in config or not config.allowed_origin:"},{"line_number":125,"context_line":"            LOG.warn(\u0027Config block %s does not contain \\\u0027allowed_origin\\\u0027, \u0027"}],"source_content_type":"text/x-python","patch_set":14,"id":"9aa53dc9_f277649d","line":122,"updated":"2015-04-08 04:25:14.000000000","message":"If you create a separate copy of the opts for each group, you could use set_defaults() to update their defaults based on the values in the main \u0027cors\u0027 group here, instead of having the loop on lines 129..137.","commit_id":"bcb2b24349cc5d13d5dd11b5f67e6b71e1b3b9f7"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"9e8b28f3895f49a839cd6093233a57ec574ac8e7","unresolved":false,"context_lines":[{"line_number":119,"context_line":"        \"\"\""},{"line_number":120,"context_line":"        # There\u0027s no harm in registering a conf blog twice (In case it was"},{"line_number":121,"context_line":"        # already registered somewhere else, like in a Unit test)."},{"line_number":122,"context_line":"        CONF.register_opts(CORS_SUBGROUP_OPTS, group_name)"},{"line_number":123,"context_line":"        config \u003d CONF[group_name]"},{"line_number":124,"context_line":"        if \u0027allowed_origin\u0027 not in config or not config.allowed_origin:"},{"line_number":125,"context_line":"            LOG.warn(\u0027Config block %s does not contain \\\u0027allowed_origin\\\u0027, \u0027"}],"source_content_type":"text/x-python","patch_set":14,"id":"9aa53dc9_99d49d20","line":122,"in_reply_to":"9aa53dc9_cb9b6f71","updated":"2015-04-08 18:11:42.000000000","message":"Yes, that\u0027s right. That avoids the need to delete the existing default values, and uses the public APIs for changing the defaults while still allowing overrides from the config namespace.","commit_id":"bcb2b24349cc5d13d5dd11b5f67e6b71e1b3b9f7"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"493ca518a6e0ac8a0f43a766850b5f55b9a60ce8","unresolved":false,"context_lines":[{"line_number":119,"context_line":"        \"\"\""},{"line_number":120,"context_line":"        # There\u0027s no harm in registering a conf blog twice (In case it was"},{"line_number":121,"context_line":"        # already registered somewhere else, like in a Unit test)."},{"line_number":122,"context_line":"        CONF.register_opts(CORS_SUBGROUP_OPTS, group_name)"},{"line_number":123,"context_line":"        config \u003d CONF[group_name]"},{"line_number":124,"context_line":"        if \u0027allowed_origin\u0027 not in config or not config.allowed_origin:"},{"line_number":125,"context_line":"            LOG.warn(\u0027Config block %s does not contain \\\u0027allowed_origin\\\u0027, \u0027"}],"source_content_type":"text/x-python","patch_set":14,"id":"9aa53dc9_cb9b6f71","line":122,"in_reply_to":"9aa53dc9_f277649d","updated":"2015-04-08 17:26:30.000000000","message":"I think I get what you\u0027re saying. So I create the CORS_OPTS, and do _not_ create CORS_SUBGROUP_OPTS. Then, in this section, I create a copy of CORS_OPTS, set the defaults to whatever is accessible in CONF.cors. Is that what you mean?","commit_id":"bcb2b24349cc5d13d5dd11b5f67e6b71e1b3b9f7"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"6d59db4560f547ab2da99b38a5d7606dbe7de3bb","unresolved":false,"context_lines":[{"line_number":159,"context_line":"            for value in request.headers[header_name].rsplit(\u0027,\u0027):"},{"line_number":160,"context_line":"                value \u003d value.strip()"},{"line_number":161,"context_line":"                if value:"},{"line_number":162,"context_line":"                    values.append(value.strip())"},{"line_number":163,"context_line":"        return values"},{"line_number":164,"context_line":""},{"line_number":165,"context_line":"    def _apply_cors_preflight_headers(self, request, response):"}],"source_content_type":"text/x-python","patch_set":14,"id":"9aa53dc9_f2852459","line":162,"updated":"2015-04-08 04:25:14.000000000","message":"value has already been stripped, so doesn\u0027t need it again.","commit_id":"bcb2b24349cc5d13d5dd11b5f67e6b71e1b3b9f7"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"493ca518a6e0ac8a0f43a766850b5f55b9a60ce8","unresolved":false,"context_lines":[{"line_number":159,"context_line":"            for value in request.headers[header_name].rsplit(\u0027,\u0027):"},{"line_number":160,"context_line":"                value \u003d value.strip()"},{"line_number":161,"context_line":"                if value:"},{"line_number":162,"context_line":"                    values.append(value.strip())"},{"line_number":163,"context_line":"        return values"},{"line_number":164,"context_line":""},{"line_number":165,"context_line":"    def _apply_cors_preflight_headers(self, request, response):"}],"source_content_type":"text/x-python","patch_set":14,"id":"9aa53dc9_2b7e5b19","line":162,"in_reply_to":"9aa53dc9_f2852459","updated":"2015-04-08 17:26:30.000000000","message":"Good catch.","commit_id":"bcb2b24349cc5d13d5dd11b5f67e6b71e1b3b9f7"}],"oslo_middleware/opts.py":[{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"fa4f09b1672948e408dd2baddd29b5468766c0ce","unresolved":false,"context_lines":[{"line_number":46,"context_line":"    return ["},{"line_number":47,"context_line":"        (\u0027oslo_middleware\u0027, copy.deepcopy(sizelimit._opts)),"},{"line_number":48,"context_line":"        (\u0027cors\u0027, copy.deepcopy(cors.CORS_OPTS)),"},{"line_number":49,"context_line":"        (\u0027cors.subdomain\u0027, copy.deepcopy(cors.CORS_OPTS))"},{"line_number":50,"context_line":"    ]"}],"source_content_type":"text/x-python","patch_set":9,"id":"9aa53dc9_592fa3a1","line":49,"updated":"2015-04-06 16:42:29.000000000","message":"Should this be CORS_SUBGROUP_OPTS?","commit_id":"6d0bcb141cd9577335efcbeaaafd7bb89e8ccc18"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"90f2c9ddb71e41411570a77f1066fa26a4d101bc","unresolved":false,"context_lines":[{"line_number":46,"context_line":"    return ["},{"line_number":47,"context_line":"        (\u0027oslo_middleware\u0027, copy.deepcopy(sizelimit._opts)),"},{"line_number":48,"context_line":"        (\u0027cors\u0027, copy.deepcopy(cors.CORS_OPTS)),"},{"line_number":49,"context_line":"        (\u0027cors.subdomain\u0027, copy.deepcopy(cors.CORS_OPTS))"},{"line_number":50,"context_line":"    ]"}],"source_content_type":"text/x-python","patch_set":9,"id":"9aa53dc9_6dc4dc3f","line":49,"in_reply_to":"9aa53dc9_592fa3a1","updated":"2015-04-06 18:11:14.000000000","message":"It could be. They\u0027re identical, except that CORS_SUBGROUP_OPTS doesn\u0027t include default values.","commit_id":"6d0bcb141cd9577335efcbeaaafd7bb89e8ccc18"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"862716244e45c5deb818be9809860e004a08c4d0","unresolved":false,"context_lines":[{"line_number":46,"context_line":"    return ["},{"line_number":47,"context_line":"        (\u0027oslo_middleware\u0027, copy.deepcopy(sizelimit._opts)),"},{"line_number":48,"context_line":"        (\u0027cors\u0027, copy.deepcopy(cors.CORS_OPTS)),"},{"line_number":49,"context_line":"        (\u0027cors.subdomain\u0027, copy.deepcopy(cors.CORS_OPTS))"},{"line_number":50,"context_line":"    ]"}],"source_content_type":"text/x-python","patch_set":11,"id":"9aa53dc9_71d8361e","line":49,"updated":"2015-04-06 18:41:01.000000000","message":"Reverted this after discussions with bnemec in channel.","commit_id":"3d0f353cad41ac5ebbdfd38e0146cdf1ae8affb3"}],"oslo_middleware/tests/test_cors.py":[{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"c9bbbd642f0c5cafb3ee2f3b103bf46e5ee76bad","unresolved":false,"context_lines":[{"line_number":193,"context_line":"            request.headers[\u0027Origin\u0027] \u003d \u0027http://invalid.example.com\u0027"},{"line_number":194,"context_line":"            response \u003d request.get_response(self.application)"},{"line_number":195,"context_line":"            self.assertCORSResponse(response,"},{"line_number":196,"context_line":"                                    status\u003d\u0027200 OK\u0027,"},{"line_number":197,"context_line":"                                    allow_origin\u003dNone,"},{"line_number":198,"context_line":"                                    max_age\u003dNone,"},{"line_number":199,"context_line":"                                    allow_methods\u003dNone,"}],"source_content_type":"text/x-python","patch_set":13,"id":"9aa53dc9_c0ac9737","line":196,"updated":"2015-04-07 21:13:58.000000000","message":"is status always suppose to be OK even if it\u0027s not allowed?","commit_id":"e314153a4902708517f344376abdb425f04c95c8"},{"author":{"_account_id":9717,"name":"Michael Krotscheck","email":"krotscheck@gmail.com","username":"krotscheck"},"change_message_id":"806af69f9fd728a8acbcb20d20d7a7a3e626c393","unresolved":false,"context_lines":[{"line_number":193,"context_line":"            request.headers[\u0027Origin\u0027] \u003d \u0027http://invalid.example.com\u0027"},{"line_number":194,"context_line":"            response \u003d request.get_response(self.application)"},{"line_number":195,"context_line":"            self.assertCORSResponse(response,"},{"line_number":196,"context_line":"                                    status\u003d\u0027200 OK\u0027,"},{"line_number":197,"context_line":"                                    allow_origin\u003dNone,"},{"line_number":198,"context_line":"                                    max_age\u003dNone,"},{"line_number":199,"context_line":"                                    allow_methods\u003dNone,"}],"source_content_type":"text/x-python","patch_set":13,"id":"9aa53dc9_e340c5a7","line":196,"in_reply_to":"9aa53dc9_c0ac9737","updated":"2015-04-07 21:29:45.000000000","message":"Yes, because the CORS headers do not actually inform the API response itself. The 200 response here is just what the \u0027hello world\u0027 application I set up in CORSTestBase returns.\n\nThe stupid thing about CORS is that it actually doesn\u0027t prevent you from making API requests - it just prevents a compliant client runtime (such as a browser) from seeing the results.","commit_id":"e314153a4902708517f344376abdb425f04c95c8"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"a3ef47f2b3a558aac863dccbf1f56ba537fa28fe","unresolved":false,"context_lines":[{"line_number":193,"context_line":"            request.headers[\u0027Origin\u0027] \u003d \u0027http://invalid.example.com\u0027"},{"line_number":194,"context_line":"            response \u003d request.get_response(self.application)"},{"line_number":195,"context_line":"            self.assertCORSResponse(response,"},{"line_number":196,"context_line":"                                    status\u003d\u0027200 OK\u0027,"},{"line_number":197,"context_line":"                                    allow_origin\u003dNone,"},{"line_number":198,"context_line":"                                    max_age\u003dNone,"},{"line_number":199,"context_line":"                                    allow_methods\u003dNone,"}],"source_content_type":"text/x-python","patch_set":13,"id":"9aa53dc9_b60f992d","line":196,"in_reply_to":"9aa53dc9_e340c5a7","updated":"2015-04-07 21:41:26.000000000","message":"oh... yeah, i assumed it\u0027d do the former.","commit_id":"e314153a4902708517f344376abdb425f04c95c8"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"d6d07e13ed9d444ae9579fc782304bbdb57c2455","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            }"},{"line_number":73,"context_line":"        }"},{"line_number":74,"context_line":"        namespace \u003d cfg.CONF._namespace"},{"line_number":75,"context_line":"        namespace._add_parsed_config_file(raw_config, raw_config)"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"        # Now that the config is set up, create our application."},{"line_number":78,"context_line":"        self.application \u003d cors.CORS(application, cfg.CONF)"}],"source_content_type":"text/x-python","patch_set":15,"id":"9aa53dc9_675d9878","line":75,"updated":"2015-04-09 12:26:40.000000000","message":"This is OK for now, but we should really add a fixture to oslo.config to protect this private API.","commit_id":"027dd345f3ae6c2bd4fcda5d664e5eb71131bcd7"}]}
