Opened 4 years ago

Closed 4 years ago

# RPC ticket.update() timestamp handling broken by Trac 0.13dev

Reported by: Owned by: osimons osimons normal XmlRpcPlugin normal framay, rjollos, jorrit 0.12

### Description

In trac:changeset:10687 for trac:ticket:7145, the timestamp validation code was changed - both changing argument name and its format. This breaks the RPC plugin ticket update handling.

This issue was raised on unrelated ticket #8644, and any relevant information should be moved here.

### comment:1 follow-up: ↓ 5 Changed 4 years ago by osimons

Here is a very ugly patch that makes things work again across versions, but it is made mostly as an illustration of problem of changing argument name and format. I will apply the patch only of other efforts to revert original behaviour @ trac:ticket:7145 fails...:

• ## trunk/tracrpc/ticket.py

 a class TicketRPC(Component): req.args.update(attributes) req.args['comment'] = comment req.args['ts'] = time_changed # 0.13 timestamp compat, see trac:ticket:7145#comment:50 if time_changed == str(t.time_changed): # same -> remake the required timestamp req.args['view_time'] = str(to_utimestamp(t.time_changed)) else: # collision -> make it valid but different req.args['view_time'] = '1' changes, problems = tm.get_ticket_changes(req, t, action) for warning in problems: add_warning(req, "Rpc ticket.update: %s" % warning)

### comment:2 follow-up: ↓ 3 Changed 4 years ago by framay

Might trac:ticket:10644 solve some of the problems of this ticket?

### comment:3 in reply to: ↑ 2 Changed 4 years ago by osimons

Might trac:ticket:10644 solve some of the problems of this ticket?

No, not really. The compat issues between Trac versions remain (changing argument name and format). And extending the parser would obviously just work for latest Trac version, so that for 0.11/0.12 I would need to either add code to ignore it or add a tracrpc.util compat version of the function to handle it across Trac versions.

Being and API I to make the information readable. So I much rather prefer using a readable timestamp than just the microsecond number currently used by Trac 0.13dev. However, RPC can continue to use its readable version as long as there is a consistent logic in converting 'to' and 'from'.

### comment:5 in reply to: ↑ 1 Changed 4 years ago by anonymous

Here is a very ugly patch that makes things work again across versions, but it is made mostly as an illustration of problem of changing argument name and format. I will apply the patch only of other efforts to revert original behaviour @ trac:ticket:7145 fails...:

fwiw +1

I've considered these modifications in this patch for this ticket and everything seems to be working fine . There might be side-effects but we won't be responsible for the conflicts and they will be suffered by merely using Trac>=1.0 . Even if patch seems to be ugly , I don't there's much more we can do about this subject .

... so ... if u ask me : green light ... go ! go ! go ! :)

### Changed 4 years ago by osimons

More elaborate patch that also switches to using integer timestamp.

### comment:7 Changed 4 years ago by osimons

attachment:t9921-ticket_update_timestamp_B-r11409.diff is a more elaborate version of the quick fix, this time also switching to use the integer UTC timestamp stored on the ticket - second or microsecond depending on Trac version.

It is likely a more precise and reliable way of doing timestamp handling, even if we loose something on readability.

### comment:8 Changed 4 years ago by osimons

• Resolution set to fixed
• Status changed from new to closed

(In [12168]) XmlRpcPlugin: Trac 0.13+/1.0+ changes timestamps for ticket updates. Added compat code. Fixes #9921.