Modify

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9579 closed defect (fixed)

trac-admin add is broken

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

Description (last modified by Ryan J Ollos)

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 6 years ago by Ryan J Ollos

Description: modified (diff)

comment:2 Changed 6 years ago by Ryan J Ollos

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 6 years ago by Ryan J Ollos

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 6 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

(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 6 years ago by Radek Bartoň

Thanks rjollos for the fix.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Radek Bartoň.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.