Skip to content

Commit

Permalink
Merge pull request #342 from joke2k/develop
Browse files Browse the repository at this point in the history
Release v0.8.1
  • Loading branch information
sergeyklay authored Oct 19, 2021
2 parents d3f4b01 + e1232cb commit 44ac664
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is inspired by `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.

`v0.8.1`_ - 20-October-2021

Fixed
+++++
- Fixed "Invalid line" spam logs on blank lines in env file
`#340 <https://github.com/joke2k/django-environ/issues/340>`_.
- Fixed ``memcache``/``pymemcache`` URL parsing for correct identification of
connection type `#337 <https://github.com/joke2k/django-environ/issues/337>`_.


`v0.8.0`_ - 17-October-2021
------------------------------
Added
Expand Down Expand Up @@ -246,6 +256,7 @@ Added
- Initial release.


.. _v0.8.1: https://github.com/joke2k/django-environ/compare/v0.8.0...v0.8.1
.. _v0.8.0: https://github.com/joke2k/django-environ/compare/v0.7.0...v0.8.0
.. _v0.7.0: https://github.com/joke2k/django-environ/compare/v0.6.0...v0.7.0
.. _v0.6.0: https://github.com/joke2k/django-environ/compare/v0.5.0...v0.6.0
Expand Down
2 changes: 1 addition & 1 deletion environ/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


__copyright__ = 'Copyright (C) 2021 Daniele Faraglia'
__version__ = '0.8.0'
__version__ = '0.8.1'
__license__ = 'MIT'
__author__ = 'Daniele Faraglia'
__author_email__ = 'daniele.faraglia@gmail.com'
Expand Down
13 changes: 12 additions & 1 deletion environ/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,15 @@ def cache_url_config(cls, url, backend=None):
'LOCATION': url.netloc + url.path,
})

if url.path and url.scheme in ['memcache', 'pymemcache']:
# urlparse('pymemcache://127.0.0.1:11211')
# => netloc='127.0.0.1:11211', path=''
#
# urlparse('pymemcache://memcached:11211/?key_prefix=ci')
# => netloc='memcached:11211', path='/'
#
# urlparse('memcache:///tmp/memcached.sock')
# => netloc='', path='/tmp/memcached.sock'
if not url.netloc and url.scheme in ['memcache', 'pymemcache']:
config.update({
'LOCATION': 'unix:' + url.path,
})
Expand Down Expand Up @@ -821,6 +829,9 @@ def _keep_escaped_format_characters(match):
val = re.sub(r'\\(.)', _keep_escaped_format_characters,
m3.group(1))
overrides[key] = str(val)
elif not line or line.startswith('#'):
# ignore warnings for empty line-breaks or comments
pass
else:
logger.warning('Invalid line: %s', line)

Expand Down
4 changes: 4 additions & 0 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ def test_base_options_parsing():
('pymemcache://127.0.0.1:11211',
PYMEMCACHE_DRIVER,
'127.0.0.1:11211'),
('pymemcache://memcached:11211/?key_prefix=ci',
PYMEMCACHE_DRIVER,
'memcached:11211'),
],
ids=[
'dbcache',
Expand All @@ -84,6 +87,7 @@ def test_base_options_parsing():
'memcached_multiple',
'memcached',
'pylibmccache',
'pylibmccache_trailing_slash',
],
)
def test_cache_parsing(url, backend, location):
Expand Down
10 changes: 10 additions & 0 deletions tests/test_env.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
DICT_VAR=foo=bar,test=on

# Database variables
DATABASE_MYSQL_URL=mysql://bea6eb0:69772142@us-cdbr-east.cleardb.com/heroku_97681?reconnect=true
DATABASE_MYSQL_CLOUDSQL_URL=mysql://djuser:hidden-password@//cloudsql/arvore-codelab:us-central1:mysqlinstance/mydatabase
DATABASE_MYSQL_GIS_URL=mysqlgis://user:password@127.0.0.1/some_database

# Cache variables
CACHE_URL=memcache://127.0.0.1:11211
CACHE_REDIS=rediscache://127.0.0.1:6379/1?client_class=django_redis.client.DefaultClient&password=secret

# Email variables
EMAIL_URL=smtps://user@domain.com:password@smtp.example.com:587

# Others
URL_VAR=http://www.google.com/
PATH_VAR=/home/dev
BOOL_TRUE_STRING_LIKE_INT='1'
Expand Down Expand Up @@ -45,4 +53,6 @@ DATABASE_ORACLE_TNS_URL=oracle://user:password@sid
DATABASE_ORACLE_URL=oracle://user:password@host:1521/sid
DATABASE_REDSHIFT_URL=redshift://user:password@examplecluster.abc123xyz789.us-west-2.redshift.amazonaws.com:5439/dev
DATABASE_CUSTOM_BACKEND_URL=custom.backend://user:password@example.com:5430/database

# Exports
export EXPORTED_VAR="exported var"

0 comments on commit 44ac664

Please sign in to comment.