summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Krotscheck <krotscheck@gmail.com>2016-05-04 10:15:19 -0700
committerMichael Krotscheck <krotscheck@gmail.com>2016-05-05 05:03:34 -0700
commite9c3a23e845d8c53b266a3b2e4ca7fb0a5a0425a (patch)
tree85dce46d69b682ccbe6e04d17320552bc0c2f453
parent9673e634966df3792d4103e5fd7ac156cd9ba677 (diff)
downloadoslo-middleware-e9c3a23e845d8c53b266a3b2e4ca7fb0a5a0425a.tar.gz
Deprecated set_latent
With the introduction of set_defaults, as well as new documentation features for default values in oslo_config, the CORS middleware has been placed in the odd position where its configuration behaves inconsistently. A user may use set_defaults to set persisted default values that may be overridden, or they may use set_latent to add values that will be applied to every request. As both of these serve essentially the same function, and the latter is only necessary if it is feasible to configure multiple allowed_origins with different CORS properties. With the depecation of multiple configuration blocks, it is no longer necessary to maintain this feature. Therefore, this patch adds the necessary deprecation flags, and removes it from the documentation. Change-Id: Icd44684b3d05ff6a07665348c08adff8245f2523
-rw-r--r--doc/source/cors.rst18
-rw-r--r--oslo_middleware/cors.py4
2 files changed, 4 insertions, 18 deletions
diff --git a/doc/source/cors.rst b/doc/source/cors.rst
index 99e5dc0..dbd93a3 100644
--- a/doc/source/cors.rst
+++ b/doc/source/cors.rst
@@ -79,18 +79,6 @@ reasonable human-readable string::
allowed_origin=*
allow_methods=GET
-If your software requires specific headers or methods for proper operation, you
-may include these as latent properties. These will be evaluated in addition
-to any found in configuration::
-
- from oslo_middleware import cors
-
- app = cors.CORS(your_wsgi_application)
- app.set_latent(allow_headers=['X-System-Header'],
- expose_headers=['X-System-Header'],
- allow_methods=['GET','PATCH'])
-
-
Configuration for pastedeploy
-----------------------------
@@ -116,12 +104,6 @@ configuration, this may be done as follows.::
# Optional field, in case the program name is different from the project:
oslo_config_program = oslo_project_name-api
- # This method also permits setting latent properties, for any origins set
- # in oslo config.
- latent_allow_headers=X-Auth-Token
- latent_expose_headers=X-Auth-Token
- latent_methods=GET,PUT,POST
-
Configuration Options
---------------------
diff --git a/oslo_middleware/cors.py b/oslo_middleware/cors.py
index 3d7b49b..ffd54ed 100644
--- a/oslo_middleware/cors.py
+++ b/oslo_middleware/cors.py
@@ -14,6 +14,7 @@
# Default allowed headers
import copy
+from debtcollector import moves
import logging
from oslo_config import cfg
@@ -243,6 +244,9 @@ class CORS(base.ConfigurableMiddleware):
'allow_headers': allow_headers
}
+ @moves.moved_method('set_defaults',
+ message='CORS.set_latent has been deprecated in favor '
+ 'of oslo_middleware.cors.set_defaults')
def set_latent(self, allow_headers=None, allow_methods=None,
expose_headers=None):
'''Add a new latent property for this middleware.