diff --git a/pagure/api/issue.py b/pagure/api/issue.py index 10e2eb1..1e929c2 100644 --- a/pagure/api/issue.py +++ b/pagure/api/issue.py @@ -14,6 +14,7 @@ import flask import datetime import logging +import arrow from sqlalchemy.exc import SQLAlchemyError import pagure.exceptions @@ -518,7 +519,7 @@ def api_view_issues(repo, username=None, namespace=None): if since.isdigit(): # We assume its a timestamp, so convert it to datetime try: - updated_after = datetime.datetime.fromtimestamp(int(since)) + updated_after = arrow.get(int(since)).datetime except ValueError: raise pagure.exceptions.APIError( 400, error_code=APIERROR.ETIMESTAMP) diff --git a/pagure/lib/model.py b/pagure/lib/model.py index f87d3dd..000dab9 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -2275,7 +2275,7 @@ class PagureGroup(BASE): 'description': self.description, 'group_type': self.group_type, 'creator': self.creator.to_json(public=public), - 'date_created': str(arrow.get(self.date_created).timestamp), + 'date_created': str(arrow.get(self.created).timestamp), 'members': [user.username for user in self.users] } diff --git a/tests/test_pagure_flask_api_issue.py b/tests/test_pagure_flask_api_issue.py index 2365a4b..b192a97 100644 --- a/tests/test_pagure_flask_api_issue.py +++ b/tests/test_pagure_flask_api_issue.py @@ -1647,7 +1647,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): 'no_stones': None, 'order': None, 'priority': None, - "since": start, + "since": str(start), "status": None, "tags": [] }, @@ -1673,7 +1673,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): 'no_stones': None, 'order': None, 'priority': None, - "since": middle, + "since": str(middle), "status": None, "tags": [] }, @@ -1699,7 +1699,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): 'no_stones': None, 'order': None, 'priority': None, - "since": final, + "since": str(final), "status": None, "tags": [] }, @@ -1728,7 +1728,7 @@ class PagureFlaskApiIssuetests(tests.SimplePagureTest): 'no_stones': None, 'order': None, 'priority': None, - "since": final, + "since": str(final), "status": None, "tags": [] },