# Ticket #9921 (closed defect: fixed)

Opened 1 year ago

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

Reported by: Assigned to: 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.

## Change History

### (follow-up: ↓ 5 ) 03/24/12 20:25:31 changed 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...:

--- a/trunk/tracrpc/ticket.py
+++ b/trunk/tracrpc/ticket.py
@@ -232,6 +232,13 @@ 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)


### (follow-up: ↓ 3 ) 03/29/12 07:49:52 changed by framay

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

### (in reply to: ↑ 2 ) 03/29/12 11:03:35 changed 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'.

### (in reply to: ↑ 1 ) 10/03/12 19:37:41 changed 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 ! :)

### 10/03/12 19:50:42 changed by rjollos

• cc changed from framay to framay, rjollos.

### 10/03/12 21:18:42 changed by osimons

More elaborate patch that also switches to using integer timestamp.

### 10/03/12 21:23:42 changed 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.

### 10/04/12 14:42:15 changed by jorrit

• cc changed from framay, rjollos to framay, rjollos, jorrit.

### 10/15/12 12:20:30 changed by osimons

• status changed from new to closed.
• resolution set to fixed.

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

### Add/Change #9921 (RPC ticket.update() timestamp handling broken by Trac 0.13dev)

Change Properties