Modify

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#12479 closed defect (fixed)

Trac 1.2 incompatibility

Reported by: sdegrande Owned by: Ryan J Ollos
Priority: normal Component: DownloadsPlugin
Severity: normal Keywords:
Cc: Ryan J Ollos Trac Release: 1.2

Description

Please find attached a quick patch to have this plugin work with Trac 1.2 (python 2.7).

Thanks for your work.

Attachments (1)

fix_1.2_compat.diff (14.0 KB) - added by sdegrande 9 years ago.

Download all attachments as: .zip

Change History (12)

Changed 9 years ago by sdegrande

Attachment: fix_1.2_compat.diff added

comment:1 Changed 9 years ago by Ryan J Ollos

Status: newaccepted

comment:2 Changed 9 years ago by Ryan J Ollos

I haven't tested the patch yet. Could you provided some details on the commented IRequestHandler implementation in tracdownloads/core.py?

comment:3 Changed 9 years ago by sdegrande

(Sorry, I forgot to clean the patch before to send it...)

DownloadsCore as well as DownloadsDownloads implement IRequestHandler.

Those two components catch the same regexp to react to a file download request. The two set an 'action' flag to 'get-file'. And the two set a context's realm ("downloads-core" for the first, "downloads-downloads" for the second).

In api.py:_get_modes(), the 'get-file' action is only checked if the realm is 'downloads-core'. It means that the file gets downloaded only if DownloadsCore handles the request.

It was working before Trac 1.2, but does no more work now (when you click on a file link to download it, nothing happens).

My guess is that Trac 1.2 introduced a change in the order of execution of RequestHandlers: in Trac 1.1, DownloadsCore was called first, but in Trac 1.2 DownloadsDownloads is called first.

Well, just a guess...

I do not know what was the initial idea of the author, and I chose to use DownloadsDownloads to handle all the requests.

Note that the 'elif context.resource.realm == 'downloads-core': ....' alternative in api.py:_get_modes() is also to be removed...

Worth sending you a clean version of the patch ? (My initial intention was not to submit a patch ready to be committed, but rather some 'indication' on how to fix the issue. Sorry about that !!!)

comment:4 in reply to:  3 Changed 9 years ago by Ryan J Ollos

Replying to sdegrande:

It was working before Trac 1.2, but does no more work now (when you click on a file link to download it, nothing happens).

My guess is that Trac 1.2 introduced a change in the order of execution of RequestHandlers: in Trac 1.1, DownloadsCore was called first, but in Trac 1.2 DownloadsDownloads is called first.

The ordering might have changed due to [trac 12922#file7]. The IRequestHandlers are stored in dict.

Worth sending you a clean version of the patch ? (My initial intention was not to submit a patch ready to be committed, but rather some 'indication' on how to fix the issue. Sorry about that !!!)

Yeah, feel free to rework the patch and post for review, or just commit yourself. We can review things after they are committed, but it's nice to have a clean commit history by reviewing first.

comment:5 Changed 9 years ago by Ryan J Ollos

Owner: changed from Ryan J Ollos to sdegrande
Status: acceptedassigned

comment:6 Changed 9 years ago by Jun Omae

#12716 was closed as duplicate.

comment:7 Changed 8 years ago by Ryan J Ollos

Owner: changed from sdegrande to Ryan J Ollos
Status: assignedaccepted

comment:8 Changed 8 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 16015:

1.0.0dev: Adapt to Trac 1.0 database API

Fix issue with duplicate request handlers.

Initial patch by sdegrande.

Fixes #12479.

comment:9 Changed 8 years ago by Ryan J Ollos

@sdegrande: Please test if you can, and report back whether the changes are working well for you.

comment:10 Changed 8 years ago by Ryan J Ollos

In 16017:

1.0.0dev: Remove unused imports

Refs #12479.

comment:11 Changed 8 years ago by Ryan J Ollos

In 16019:

1.0.0dev: Replace use of deprecated has_permission

Refs #12479.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
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.