Skip to content

Commit 39b99cc

Browse files
committed
fix: arrow 'timestamp' property removed in >=v1.0.0
The missing property in newer arrow versions, caused that variables only contained references like '<bound method Arrow.timestamp of <Arrow [2023-01-15T02:16:14.627656+00:00]>>' instead the actual timestamp values. Tests in 'tests/test_pagure_flask_dump_load_ticket.py' failed with 'ValueError: could not convert string to float'. References https://arrow.readthedocs.io/en/latest/releases.html Quote: 'Calls to the timestamp property now emit a DeprecationWarning.' arrow-py/arrow#832 Quote: 'The .timestamp property has been removed to improve compatibility with datetime. Use .int_timestamp for the same results.' libgit2/pygit2#1122
1 parent e830f17 commit 39b99cc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pagure/lib/model.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ def create_default_status(session, acls=None):
152152

153153

154154
def arrow_ts(value):
155-
return "%s" % arrow.get(value).timestamp
155+
if hasattr(arrow, 'timestamp'):
156+
return "%s" % arrow.get(value).timestamp # arrow < v1.0.0
157+
else:
158+
return "%s" % arrow.get(value).int_timestamp # arrow >= v1.0.0
156159

157160

158161
class AccessLevels(BASE):

0 commit comments

Comments
 (0)