aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2015-10-14 17:17:15 -0400
committerTeddy Wing2015-10-14 18:06:31 -0400
commit4c9f833511e42e5aa2ca929829efdd086abddec2 (patch)
tree2689bd3d6c1a0e677d250fe89b82c53196ccd14b
parentd4ff4f1ff727b02ac875c02538713e3c40627110 (diff)
downloaddjango-brevisurl-make-max-length-settings-variable-backwards-compatible.tar.bz2
Make `LOCAL_BACKEND_ORIGINAL_URL_MAX_LENGTH` backwards-compatiblemake-max-length-settings-variable-backwards-compatible
Build on d4ff4f1ff727b02ac875c02538713e3c40627110 which updates the `LOCAL_BACKEND_ORIGINAL_URL_MAX_LENGTH` setting to match the documentation. This change adds backwards-compatibility to `LOCAL_BACKEND_ORIGINAL_URL_MAX_LENGTH`, allowing it to be updated by both the older `SHORTURL_LOCAL_BACKEND_ORIGINAL_URL_MAX_LENGTH` and the newer `BREVISURL_LOCAL_BACKEND_ORIGINAL_URL_MAX_LENGTH` user settings to ensure that this settings change doesn't break the package for existing users.
-rw-r--r--brevisurl/settings.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/brevisurl/settings.py b/brevisurl/settings.py
index 22db32f..6d6ebca 100644
--- a/brevisurl/settings.py
+++ b/brevisurl/settings.py
@@ -16,7 +16,15 @@ LOCAL_BACKEND_TOKEN_CHARS = getattr(settings, 'BREVISURL_LOCAL_BACKEND_TOKEN_CHA
LOCAL_BACKEND_TOKEN_LENGTH = getattr(settings, 'BREVISURL_LOCAL_BACKEND_TOKEN_LENGTH', 5)
# Settings for url max length.
-LOCAL_BACKEND_ORIGINAL_URL_MAX_LENGTH = getattr(settings, 'BREVISURL_LOCAL_BACKEND_ORIGINAL_URL_MAX_LENGTH', 200)
+# Ask for ``SHORTURL_LOCAL_BACKEND_ORIGINAL_URL_MAX_LENGTH`` for backwards
+# compatibility
+LOCAL_BACKEND_ORIGINAL_URL_MAX_LENGTH = getattr(
+ settings,
+ 'BREVISURL_LOCAL_BACKEND_ORIGINAL_URL_MAX_LENGTH',
+ getattr(
+ settings,
+ 'SHORTURL_LOCAL_BACKEND_ORIGINAL_URL_MAX_LENGTH',
+ 200))
# Settings for url pattern.
LOCAL_BACKEND_URL_PATTERN = getattr(settings, 'BREVISURL_LOCAL_BACKEND_URL_PATTERN',