1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +03:00

Added fix for _handle_comment

This commit is contained in:
Valery Sinelnikov 2023-06-15 17:42:03 +04:00
parent beb555bdf2
commit 51f4b3aa18

View File

@ -82,12 +82,12 @@ class GpoaConfigObj(ConfigObj):
def _handle_comment(self, comment):
"""Deal with a comment."""
if not comment.strip():
return comment or '' # return trailing whitespace as-is
if not comment:
return ''
start = self.indent_type
if not (comment.lstrip().startswith('#') or comment.lstrip().startswith(';')):
if not comment.lstrip().startswith(tuple(self.COMMENT_MARKERS)):
start += ' # '
return (start + comment)
return start + comment.strip()
def _parse(self, infile):
"""Actually parse the config file."""