mirror of
https://github.com/certbot/certbot.git
synced 2026-06-08 16:22:18 -04:00
Change as_string to a __str__ in nginxparser.py
This change would make the RawNginxDumper more in line with other Python libraries and the standard library.
This commit is contained in:
parent
9549af1bad
commit
2cd0e64537
1 changed files with 6 additions and 2 deletions
|
|
@ -84,9 +84,13 @@ class RawNginxDumper(object):
|
|||
else:
|
||||
yield spacer * current_indent + key + spacer + values + ';'
|
||||
|
||||
def as_string(self):
|
||||
def __str__(self):
|
||||
"""Return the parsed block as a string."""
|
||||
return '\n'.join(self) + '\n'
|
||||
|
||||
def as_string(self):
|
||||
"""Return the parsed block as a string."""
|
||||
return str(self)
|
||||
|
||||
|
||||
# Shortcut functions to respect Python's serialization interface
|
||||
|
|
@ -122,7 +126,7 @@ def dumps(blocks, indentation=4):
|
|||
:rtype: str
|
||||
|
||||
"""
|
||||
return RawNginxDumper(blocks, indentation).as_string()
|
||||
return str(RawNginxDumper(blocks, indentation))
|
||||
|
||||
|
||||
def dump(blocks, _file, indentation=4):
|
||||
|
|
|
|||
Loading…
Reference in a new issue