#11355 closed defect (fixed)
Save from repository admin detail page with no changes doesn't redirect to the listing page — at Version 4
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.2 |
Component: | admin/web | Version: | 1.0-stable |
Severity: | normal | Keywords: | repository |
Cc: | Branch: | ||
Release Notes: |
Pressing Save on Repository Admin edit page when no changes had been made redirected back to the same page. |
||
API Changes: | |||
Internal Changes: |
Description
Pressing Save when no changes have been made to a repository doesn't redirect back to the repository listing page. This appears to be a side-effect of the changes in [10042]. The other admin pages such as Ticket Components redirect back to the listing page when no changes have been made.
Change History (4)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Status: | new → assigned |
---|
comment:3 by , 10 years ago
LGTM, however I have one thing. value &= ....
, it seems the trick. It would be simple to be the following.
-
trac/versioncontrol/admin.py
diff --git a/trac/versioncontrol/admin.py b/trac/versioncontrol/admin.py index 28d96c1..650e120 100644
a b class RepositoryAdminPanel(Component): 206 206 if (value is not None or field == 'hidden') \ 207 207 and value != info.get(field): 208 208 changes[field] = value 209 if 'dir' in changes: 210 valid &= self._check_dir(req, changes['dir']) 209 if 'dir' in changes \ 210 and not self._check_dir(req, changes['dir']): 211 valid = False 211 212 if valid and changes: 212 213 db_provider.modify_repository(reponame, changes) 213 214 add_notice(req, _('Your changes have been saved.'))
Note:
See TracTickets
for help on using tickets.
I debated several ways to fix this, including adding a
if not changes: req.redirect(req.href.admin(category, page))
early in the function. Ultimately I felt that adding thevalid
variable was the cleanest solution, and may prove more useful if other validity checks are added. Let me know if the code doesn't seem clear, or there is a better way.Proposed changes can be found in log:rjollos.git:t11355.