cli: fix changelog encode for PY3
relates [issue#577](https://pagure.io/koji/issue/577)
This commit is contained in:
parent
ac2d2c5935
commit
3464adae2e
3 changed files with 35 additions and 5 deletions
|
|
@ -48,9 +48,11 @@ try:
|
|||
except ImportError: # pragma: no cover
|
||||
from sha import new as sha1_constructor
|
||||
|
||||
|
||||
def _changelogDate(cldate):
|
||||
return time.strftime('%a %b %d %Y', time.strptime(koji.formatTime(cldate), '%Y-%m-%d %H:%M:%S'))
|
||||
|
||||
|
||||
def formatChangelog(entries):
|
||||
"""Format a list of changelog entries (dicts)
|
||||
into a string representation."""
|
||||
|
|
@ -59,9 +61,9 @@ def formatChangelog(entries):
|
|||
result += """* %s %s
|
||||
%s
|
||||
|
||||
""" % (_changelogDate(entry['date']), entry['author'].encode("utf-8"),
|
||||
entry['text'].encode("utf-8"))
|
||||
|
||||
""" % (_changelogDate(entry['date']),
|
||||
koji.fixPrint(entry['author']),
|
||||
koji.fixPrint(entry['text']))
|
||||
return result
|
||||
|
||||
DATE_RE = re.compile(r'(\d+)-(\d+)-(\d+)')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue