Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#9579 closed defect (fixed)

trac-admin add is broken

Reported by: shumisha@… Owned by: Blackhex
Priority: normal Component: DownloadsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description (last modified by rjollos)

Hello,

Trying to add file using trac-admin:

trac-admin /var/trac/my_trac/ download add my_file.php.zip  description="Latest version of my_file"

I got the following error:

AttributeError: 'DownloadsApi' object has no attribute 'store_download'

I fixed it by replacing:
api.store_download(context, download, file)

with
api._add_download( context, download, file)

in consoleadmin.py

Rgds

Attachments (0)

Change History (5)

comment:1 Changed 3 years ago by rjollos

  • Description modified (diff)

comment:2 follow-up: Changed 3 years ago by rjollos

I've only briefly look at the source code, but there is also api.add_download. By typical convention, api._add_download is probably an internal class method, so it seems likely we should be using api.add_download.

comment:3 in reply to: ↑ 2 Changed 3 years ago by rjollos

Replying to rjollos:

I've only briefly look at the source code, but there is also api.add_download. By typical convention, api._add_download is probably an internal class method, so it seems likely we should be using api.add_download.

_add_download is used in the methods called by process_request, so it seems fairly certain it is the right method to call in consoleadmin.

This is a really simple change that will fix a major defect, so I hope the plugin author will be okay if I just go ahead and commit it to the database. I will follow up quickly and remedy the situation if I'm doing something wrong here.

comment:4 Changed 3 years ago by rjollos

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

(In [11238]) Fixes #9579:

  • An instance of a call to the _store_download method had not been replaced with a call to the _add_download method.
  • Added a clarification in the docs that setting the ext option to all will allow all extensions to be uploaded.

comment:5 Changed 3 years ago by Blackhex

Thanks rjollos for the fix.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.