Modify

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#9921 closed defect (fixed)

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

Reported by: osimons Owned by: osimons
Priority: normal Component: XmlRpcPlugin
Severity: normal Keywords:
Cc: Franz, Ryan J Ollos, Jorrit Schippers Trac Release: 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.

See trac:ticket:7145#comment:50

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

Attachments (1)

t9921-ticket_update_timestamp_B-r11409.diff (4.7 KB) - added by osimons 12 years ago.
More elaborate patch that also switches to using integer timestamp.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 12 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 b class TicketRPC(Component): 
    232232            req.args.update(attributes)
    233233            req.args['comment'] = comment
    234234            req.args['ts'] = time_changed
     235            # 0.13 timestamp compat, see trac:ticket:7145#comment:50
     236            if time_changed == str(t.time_changed):
     237                # same -> remake the required timestamp
     238                req.args['view_time'] = str(to_utimestamp(t.time_changed))
     239            else:
     240                # collision -> make it valid but different
     241                req.args['view_time'] = '1'
    235242            changes, problems = tm.get_ticket_changes(req, t, action)
    236243            for warning in problems:
    237244                add_warning(req, "Rpc ticket.update: %s" % warning)

comment:2 Changed 12 years ago by Franz

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

comment:3 in reply to:  2 Changed 12 years ago by osimons

Replying to framay:

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 12 years ago by anonymous

Replying to 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...:

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 ! :)

comment:6 Changed 12 years ago by Ryan J Ollos

Cc: Ryan J Ollos added

Changed 12 years ago by osimons

More elaborate patch that also switches to using integer timestamp.

comment:7 Changed 12 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 12 years ago by Jorrit Schippers

Cc: Jorrit Schippers added

comment:8 Changed 12 years ago by osimons

Resolution: fixed
Status: newclosed

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.