Skip to content

Commit 77ebeb9

Browse files
committed
0.2
1 parent bd0cb56 commit 77ebeb9

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

nginx.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ def as_list(self):
167167
return [self.name, self.value, ret]
168168

169169
def as_dict(self):
170-
return {'{} {}'.format(self.name, self.value): [x.as_dict() for x in self.blocks]}
170+
return {'{0} {1}'.format(self.name, self.value): [x.as_dict() for x in self.blocks]}
171171

172172
def as_block(self):
173173
ret = []
174-
ret.append('{} {} {{\n'.format(self.name, self.value))
174+
ret.append('{0} {1} {{\n'.format(self.name, self.value))
175175
for x in self.blocks:
176176
if isinstance(x, (Key, Comment)):
177177
ret.append(INDENT + x.as_block())
@@ -198,7 +198,7 @@ def as_dict(self):
198198
return {'#': self.comment}
199199

200200
def as_block(self):
201-
return '# {}\n'.format(self.comment)
201+
return '# {0}\n'.format(self.comment)
202202

203203

204204
class Location(Container):
@@ -243,7 +243,7 @@ def as_dict(self):
243243
return {self.name: self.value}
244244

245245
def as_block(self):
246-
return '{} {};\n'.format(self.name, self.value)
246+
return '{0} {1};\n'.format(self.name, self.value)
247247

248248

249249
def loads(data, conf=True):
@@ -267,8 +267,9 @@ def loads(data, conf=True):
267267
lopen.insert(0, u)
268268
if re.match('.*;', line):
269269
kname, kval = re.match('.*(?:^|^\s*|{\s*)(\S+)\s(.+);', line).group(1, 2)
270-
k = Key(kname, kval)
271-
lopen[0].add(k)
270+
if "#" not in kname:
271+
k = Key(kname, kval)
272+
lopen[0].add(k)
272273
if re.match('.*}', line):
273274
closenum = len(re.findall('}', line))
274275
while closenum > 0:

setup.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44

55
setup(
66
name='python-nginx',
7-
version='0.1.4',
7+
version='0.2',
88
description='Create and modify nginx serverblock configs in Python',
99
author='Jacob Cook',
1010
author_email='jacob@peakwinter.net',
1111
url='https://github.com/peakwinter/python-nginx',
1212
py_modules=['nginx'],
1313
keywords = ['nginx', 'web servers', 'serverblock', 'server block'],
14-
download_url = 'https://github.com/peakwinter/python-nginx/archive/0.1.3.tar.gz',
14+
download_url = 'https://github.com/peakwinter/python-nginx/archive/0.2.tar.gz',
1515
license = 'GPLv3',
1616
classifiers = [
17-
"Development Status :: 3 - Alpha",
18-
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
19-
"Operating System :: Unix",
20-
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
17+
"Development Status :: 5 - Production/Stable",
18+
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
19+
"Operating System :: Unix",
20+
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
2121
]
2222
)

0 commit comments

Comments
 (0)