Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#11538 closed defect (fixed)

Unexpected keyword argument to TracError.__init__

Reported by: Ryan J Ollos Owned by: Odd Simon Simonsen
Priority: normal Component: CustomFieldAdminPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

I've been reviewing the code for possible inclusion in the Trac core, and spotted the following issue:

  • customfieldadminplugin/0.11/customfieldadmin/api.py

    diff --git a/customfieldadminplugin/0.11/customfieldadmin/api.py b/customfieldad
    index 7a263b5..03f2de9 100644
    a b class CustomFields(Component): 
    106106        # Check that it is a valid field type
    107107        if not cfield['type'] in \
    108108                        ['text', 'checkbox', 'select', 'radio', 'textarea']:
    109             raise TracError(_("%(field_type)s is not a valid field type"),
    110                                         field_type=cfield['type'])
     109            raise TracError(_("%(field_type)s is not a valid field type",
     110                              field_type=cfield['type']))
    111111        # Check that field does not already exist
    112112        # (if modify it should already be deleted)
    113113        if create and self.config.get('ticket-custom', cfield['name']):

It's unlikely to cause any issues as far as I can see since there are other checks in place, but if the TracError was raised, the following traceback would result:

Traceback (most recent call last):
  File "/home/user/Workspace/th11536/teo-rjollos.git/trac/web/main.py", line 506, in _dispatch_request
    dispatcher.dispatch(req)
  File "/home/user/Workspace/th11536/teo-rjollos.git/trac/web/main.py", line 221, in dispatch
    resp = chosen_handler.process_request(req)
  File "/home/user/Workspace/th11536/teo-rjollos.git/trac/admin/web_ui.py", line 125, in process_request
    path_info)
  File "/home/user/Workspace/trachacks.git/customfieldadminplugin/0.11/customfieldadmin/admin.py", line 87, in render_admin_panel
    cf_api.update_custom_field(cfield, create=True)
  File "/home/user/Workspace/trachacks.git/customfieldadminplugin/0.11/customfieldadmin/api.py", line 158, in update_custom_field
    self.verify_custom_field(cfield)
  File "/home/user/Workspace/trachacks.git/customfieldadminplugin/0.11/customfieldadmin/api.py", line 110, in verify_custom_field
    field_type=cfield['type'])
TypeError: __init__() got an unexpected keyword argument 'field_type'

Attachments (0)

Change History (2)

comment:1 Changed 3 years ago by Odd Simon Simonsen

Resolution: fixed
Status: newclosed

In 13638:

CustomFieldAdminPlugin: Typo in i18n error message call. Closes #11538.

Well spotted, rjollos ;-)

comment:2 in reply to:  description Changed 3 years ago by Ryan J Ollos

Replying to rjollos:

I've been reviewing the code for possible inclusion in the Trac core, ...

I think this can be done in 20-30 hours effort, so I'm going to push it for milestone:1.1.3: trac:#11469.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Odd Simon Simonsen.
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.