Edgewall Software

Opened 10 years ago

Closed 6 years ago

Last modified 6 years ago

#11371 closed enhancement (fixed)

Fixup whitespace on repository admin pages when saving changes — at Version 15

Reported by: Ryan J Ollos Owned by:
Priority: normal Milestone: 1.0.17
Component: admin/web Version: 1.0-stable
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Catch IntegrityError when adding new item and renaming item on ticket admin panels.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

The following behaviours should be implemented to make the Repository admin page consistent with the other admin pages:

  • Call simplify_whitespace on the name and alias.
  • Remove leading and trailing whitespace from the directory and url.

Also:

  • we should simplify whitespace on the Component owner field.
  • simplify_whitespace should be extended to remove zero-width spaces (comment:5:ticket:11351).

Change History (14)

comment:2 by Ryan J Ollos, 10 years ago

Also there are some issues mentioned in comment:2:ticket:11351 and comment:4:ticket:11297 that we may want to explore in this ticket.

comment:3 by Ryan J Ollos, 10 years ago

Milestone: next-stable-1.0.x1.0.3

comment:4 by Ryan J Ollos, 10 years ago

Description: modified (diff)

comment:5 by Ryan J Ollos, 10 years ago

Issue reported in SO:23956175.

comment:6 by Ryan J Ollos, 9 years ago

Owner: set to Ryan J Ollos
Status: newassigned

comment:7 by Ryan J Ollos, 9 years ago

Milestone: 1.0.3next-stable-1.0.x
Owner: Ryan J Ollos removed
Status: assignednew

comment:8 by Ryan J Ollos, 9 years ago

See related comment:5:ticket:11351.

comment:9 by Ryan J Ollos, 7 years ago

Milestone: next-stable-1.0.xnext-stable-1.2.x

Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.

comment:10 by strk@…, 6 years ago

I just got hit by this issue too, annoying indeed as it's not easy to see there's a space in the name (dirname is unquoted in trac-admin error message too)

in reply to:  1 comment:11 by Jun Omae, 6 years ago

Replying to Ryan J Ollos:

When attempting to add an item that differs from an existing item only by whitespace, the error shown below results. For example, if attempting to add milestone5 , but milestone5 already exists, the traceback results. We should trap this condition and raise the TracError, which is the typical situation when adding an existing item.

In trac/ticket/admin.py, we trap IntegrityError on saving an item but have not trapped on adding an item for milestone, component, version, enum record.

  • trac/ticket/admin.py

    diff --git a/trac/ticket/admin.py b/trac/ticket/admin.py
    index 06f1273f5..b5b513c77 100644
    a b class MilestoneAdminPanel(TicketAdminPanel):  
    286286                            mil.due = user_time(req, parse_date,
    287287                                                req.args.get('duedate'),
    288288                                                hint='datetime')
    289                         mil.insert()
    290                         add_notice(req, _('The milestone "%(name)s" has been '
    291                                           'added.', name=name))
     289                        try:
     290                            mil.insert()
     291                        except self.env.db_exc.IntegrityError:
     292                            raise TracError(_('Milestone "%(name)s" already '
     293                                              'exists.', name=name))
     294                        else:
     295                            add_notice(req, _('The milestone "%(name)s" has '
     296                                              'been added.', name=name))
    292297                    else:
    293298                        if mil.name is None:
    294299                            raise TracError(_('Invalid milestone name.'))

Proposed changes in [a18914a42/jomae.git] (jomae.git@t11371).

Last edited 6 years ago by Jun Omae (previous) (diff)

comment:12 by Ryan J Ollos, 6 years ago

comment:11 changes look good. For trunk, we'll need to catch ResourceExistsError (#11419).

Last edited 6 years ago by Ryan J Ollos (previous) (diff)

comment:14 by Ryan J Ollos, 6 years ago

The comment:13 changes look good to me.

comment:15 by Jun Omae, 6 years ago

Milestone: next-stable-1.2.x1.0.17
Release Notes: modified (diff)
Resolution: fixed
Status: newclosed

Thanks for the reviewing. Applied in [16502] and merged in [16503-16504].

Note: See TracTickets for help on using tickets.