Skip to content

Commit afcb5cd

Browse files
committed
changelog
1 parent 44d0782 commit afcb5cd

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

CHANGELOG

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
This project adheres to [Semantic Versioning](http://semver.org/).
4+
5+
## [1.0.0] - 2016-08-19
6+
### Changed
7+
- Some API changes:
8+
- `all()` methods replaced with `children` property
9+
- `as_list()` methods replaced with `as_list` property
10+
- `as_dict()` methods replaced with `as_dict` property
11+
- `as_block()` methods replaced with `as_strings` property
12+
- `conf.server` convenience property, for getting first server found in the Conf
13+
- Added `inline` property to `Comment`: set to `True` if you want the comment to be appended to the end of the previous line on dump
14+
- Added loading of inline code comments.
15+
- Cleaned code for full PEP8 compatibility and added comments.
16+
- Added simple tests.
17+
18+
19+
### Fixed
20+
- Fixed a bug where unexpected behaviour would occur when a pound symbol was used inside a key value.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ Load an nginx serverblock from a file:
3737

3838
>>> import nginx
3939
>>> c = nginx.loadf('/etc/nginx/sites-available/testsite')
40-
>>> c.all()
40+
>>> c.children
4141
[<main.Server object at 0x7f1ed4573890>]
42-
>>> c.servers[0].all()
42+
>>> c.server.children
4343
[<main.Comment object at 0x7f1ed45736d0>, <main.Key object at 0x7f1ed4573750>, <main.Key object at 0x7f1ed4573790>, <main.Location object at 0x7f1ed4573850>]
44-
>>> c.as_dict()
44+
>>> c.as_dict
4545
{'conf': [{'server': [{'#': 'This is a test comment'}, {'server_name': 'localhost'}, {'root': '/srv/http'}, {'location /': [{'allow': 'all'}]}]}]}
4646

4747
Format an nginx serverblock into a string (change the amount of spaces (or tabs) for each indentation level by modifying `nginx.INDENT` first):
4848

49-
>>> c.all()
49+
>>> c.servers
5050
[<main.Server object at 0x7f1ed4573890>]
51-
>>> c.as_block()
51+
>>> c.as_strings
5252
['server {\n', ' # This is a test comment\n', ' server_name localhost;\n', ' root /srv/http;\n', '\n location / {\n', ' allow all;\n', ' }\n\n', '}\n']
5353

5454
Find where you put your keys:

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
author_email='jacob@peakwinter.net',
1111
url='https://github.com/peakwinter/python-nginx',
1212
py_modules=['nginx'],
13-
keywords = ['nginx', 'web servers', 'serverblock', 'server block'],
14-
download_url = 'https://github.com/peakwinter/python-nginx/archive/0.2.tar.gz',
15-
license = 'GPLv3',
16-
classifiers = [
13+
keywords=['nginx', 'web servers', 'serverblock', 'server block'],
14+
download_url='https://git.coderouge.co/coderouge/python-nginx/repository/archive.zip?ref=master',
15+
license='GPLv3',
16+
classifiers=[
1717
"Development Status :: 5 - Production/Stable",
1818
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
1919
"Operating System :: Unix",

tests.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ def test_reflection(self):
7474
out_data = '\n' + nginx.dumps(inp_data)
7575
self.assertEqual(TESTBLOCK, out_data)
7676

77+
def test_filtering(self):
78+
data = nginx.loads(TESTBLOCK)
79+
self.assertEqual(len(data.server.filter('mykey')), 1)
80+
self.assertEqual(data.server.filter('nothere'), [])
81+
7782

7883
if __name__ == '__main__':
7984
unittest.main()

0 commit comments

Comments
 (0)