diff --git a/osclib/comments.py b/osclib/comments.py index 4fd47c3c..18244013 100644 --- a/osclib/comments.py +++ b/osclib/comments.py @@ -1,4 +1,5 @@ from datetime import datetime +from dateutil.parser import parse as date_parse import re from xml.etree import cElementTree as ET @@ -49,6 +50,15 @@ class CommentAPI(object): } return comment + def request_as_comment_dict(self, request): + return { + 'who': request.creator, + 'when': date_parse(request.statehistory[0].when), + 'id': '-1', + 'parent': None, + 'comment': request.description, + } + def get_comments(self, request_id=None, project_name=None, package_name=None): """Get the list of comments of an object in OBS.