Opened 18 years ago
Closed 17 years ago
#3928 closed defect (fixed)
Warning message in Wiki Delete
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.11 |
Component: | wiki system | Version: | 0.10 |
Severity: | minor | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Clicking Delete this version
button in a wiki page, warning message (This is the only version the page, so the page will be removed completely!
) is displayed, although there are multiple versions in that wiki page.
When this patch is applied, it will improve:
-
trac/wiki/web_ui.py
254 254 self._set_title(req, page, 'delete') 255 255 req.hdf['wiki'] = {'mode': 'delete'} 256 256 if version is not None: 257 num_versions = 0258 for v,t,author,comment,ipnr in page.get_history():259 if v >= old_version:260 num_versions += 1;261 if num_versions > 1:262 break263 257 req.hdf['wiki'] = {'version': version, 'old_version': old_version, 264 'only_version': num_versions == 1}258 'only_version': (old_version == 1 and version == 1)} 265 259 266 260 def _render_diff(self, req, db, page): 267 261 req.perm.assert_permission('WIKI_VIEW')
Attachments (0)
Change History (3)
comment:1 by , 18 years ago
Severity: | normal → minor |
---|
comment:2 by , 18 years ago
I understand. There're Wiki pages missing version 1.
However, page.get_history()
yeilds only one record-set when the page to be deleted has any version number, I think.
This is a patch for source:branches/0.10-stable@3941 :
-
trac/wiki/web_ui.py
256 256 if version is not None: 257 257 num_versions = 0 258 258 for v,t,author,comment,ipnr in page.get_history(): 259 if v >= old_version: 260 num_versions += 1; 261 if num_versions > 1: 262 break 259 num_versions += 1; 260 if num_versions > 1: 261 break 263 262 req.hdf['wiki'] = {'version': version, 'old_version': old_version, 264 263 'only_version': num_versions == 1} 265 264
comment:3 by , 17 years ago
Milestone: | 0.10.5 → 0.11 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
This seems to be fixed as [5386:5387]. Closing.
BTW: See #4112 for a closely related discussion.
Well, the loop you removed was there in case the version 1 got deleted somehow, but this is no longer possible due to the current restrictions that prevent removing arbitrary versions in the middle of the history. r3875 seems to be based on the same assumption, so I guess we can move in that direction (still there might be existing Trac Wikis lacking a version 1 …)