Skip to content

Commit 44ac664

Browse files
authored
Merge pull request #342 from joke2k/develop
Release v0.8.1
2 parents d3f4b01 + e1232cb commit 44ac664

File tree

5 files changed

+38
-2
lines changed

5 files changed

+38
-2
lines changed

CHANGELOG.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is inspired by `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_
66
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.
77

8+
`v0.8.1`_ - 20-October-2021
9+
10+
Fixed
11+
+++++
12+
- Fixed "Invalid line" spam logs on blank lines in env file
13+
`#340 <https://github.com/joke2k/django-environ/issues/340>`_.
14+
- Fixed ``memcache``/``pymemcache`` URL parsing for correct identification of
15+
connection type `#337 <https://github.com/joke2k/django-environ/issues/337>`_.
16+
17+
818
`v0.8.0`_ - 17-October-2021
919
------------------------------
1020
Added
@@ -246,6 +256,7 @@ Added
246256
- Initial release.
247257

248258

259+
.. _v0.8.1: https://github.com/joke2k/django-environ/compare/v0.8.0...v0.8.1
249260
.. _v0.8.0: https://github.com/joke2k/django-environ/compare/v0.7.0...v0.8.0
250261
.. _v0.7.0: https://github.com/joke2k/django-environ/compare/v0.6.0...v0.7.0
251262
.. _v0.6.0: https://github.com/joke2k/django-environ/compare/v0.5.0...v0.6.0

environ/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232

3333
__copyright__ = 'Copyright (C) 2021 Daniele Faraglia'
34-
__version__ = '0.8.0'
34+
__version__ = '0.8.1'
3535
__license__ = 'MIT'
3636
__author__ = 'Daniele Faraglia'
3737
__author_email__ = '[email protected]'

environ/environ.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,15 @@ def cache_url_config(cls, url, backend=None):
584584
'LOCATION': url.netloc + url.path,
585585
})
586586

587-
if url.path and url.scheme in ['memcache', 'pymemcache']:
587+
# urlparse('pymemcache://127.0.0.1:11211')
588+
# => netloc='127.0.0.1:11211', path=''
589+
#
590+
# urlparse('pymemcache://memcached:11211/?key_prefix=ci')
591+
# => netloc='memcached:11211', path='/'
592+
#
593+
# urlparse('memcache:///tmp/memcached.sock')
594+
# => netloc='', path='/tmp/memcached.sock'
595+
if not url.netloc and url.scheme in ['memcache', 'pymemcache']:
588596
config.update({
589597
'LOCATION': 'unix:' + url.path,
590598
})
@@ -821,6 +829,9 @@ def _keep_escaped_format_characters(match):
821829
val = re.sub(r'\\(.)', _keep_escaped_format_characters,
822830
m3.group(1))
823831
overrides[key] = str(val)
832+
elif not line or line.startswith('#'):
833+
# ignore warnings for empty line-breaks or comments
834+
pass
824835
else:
825836
logger.warning('Invalid line: %s', line)
826837

tests/test_cache.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ def test_base_options_parsing():
6868
('pymemcache://127.0.0.1:11211',
6969
PYMEMCACHE_DRIVER,
7070
'127.0.0.1:11211'),
71+
('pymemcache://memcached:11211/?key_prefix=ci',
72+
PYMEMCACHE_DRIVER,
73+
'memcached:11211'),
7174
],
7275
ids=[
7376
'dbcache',
@@ -84,6 +87,7 @@ def test_base_options_parsing():
8487
'memcached_multiple',
8588
'memcached',
8689
'pylibmccache',
90+
'pylibmccache_trailing_slash',
8791
],
8892
)
8993
def test_cache_parsing(url, backend, location):

tests/test_env.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
DICT_VAR=foo=bar,test=on
2+
3+
# Database variables
24
DATABASE_MYSQL_URL=mysql://bea6eb0:[email protected]/heroku_97681?reconnect=true
35
DATABASE_MYSQL_CLOUDSQL_URL=mysql://djuser:hidden-password@//cloudsql/arvore-codelab:us-central1:mysqlinstance/mydatabase
46
DATABASE_MYSQL_GIS_URL=mysqlgis://user:[email protected]/some_database
7+
8+
# Cache variables
59
CACHE_URL=memcache://127.0.0.1:11211
610
CACHE_REDIS=rediscache://127.0.0.1:6379/1?client_class=django_redis.client.DefaultClient&password=secret
11+
12+
# Email variables
713
14+
15+
# Others
816
URL_VAR=http://www.google.com/
917
PATH_VAR=/home/dev
1018
BOOL_TRUE_STRING_LIKE_INT='1'
@@ -45,4 +53,6 @@ DATABASE_ORACLE_TNS_URL=oracle://user:password@sid
4553
DATABASE_ORACLE_URL=oracle://user:password@host:1521/sid
4654
DATABASE_REDSHIFT_URL=redshift://user:password@examplecluster.abc123xyz789.us-west-2.redshift.amazonaws.com:5439/dev
4755
DATABASE_CUSTOM_BACKEND_URL=custom.backend://user:[email protected]:5430/database
56+
57+
# Exports
4858
export EXPORTED_VAR="exported var"

0 commit comments

Comments
 (0)