#9275 closed defect (fixed)
Whitespace normalization of milestone/component names breaks on upgrade
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | 0.12 |
Component: | ticket system | Version: | 0.12dev |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The whitespace normalization "fixes" for #7704 in r8399 unfortunately break upgrades.
If in an earlier version a milestone was saved with a name like 'foo bar' (i.e. two whitespaces) the search now normalizes the whitespace and doesnt find the milestone.
Thus *no* ticket can be edited anymore - I guess because the full list of milestones is built there, so even if only one such unnormalized component/milestone breaks all tickets.
8399 rblank name = simplify_whitespace(name) 1831 cmlenz if name: 1831 cmlenz if not db: 1831 cmlenz db = self.env.get_db_cnx() 1831 cmlenz cursor = db.cursor() 1831 cmlenz cursor.execute("SELECT value FROM enum WHERE type=%s AND name=%s", 1831 cmlenz (self.type, name))
It doesnt seem to be a good idea to do the normalization uppon searching because that will fail with earlier created milestones. Whats the point anyway? Imho that should only be done while saving.
Attachments (1)
Change History (10)
follow-up: 2 comment:1 by , 15 years ago
comment:2 by , 15 years ago
Milestone: | → 0.12 |
---|---|
Owner: | set to |
Could you please describe the symptoms you get? "No ticket can be edited anymore" is not very precise. Do you get an error? Can you provide the backtrace? Can you provide a procedure to reproduce the issue?
Replying to andres <andres@…>:
If wanted I can writeup a patch removing all the normalization uppon retrieval - its a trivial one though, so I am not sure its worth it.
Yes, please do.
Assigning to 0.12 as this is a regression.
comment:3 by , 15 years ago
Just to clarify: I believe you are right that normalization should be done only when saving, and not when retrieving. But I am interested to know how this issue manifests itself on your installation.
comment:4 by , 15 years ago
No Backtraces. The error is the (not unobvious)
Error: Invalid milestone name
either when opening "admin/ticket/milestones/<something with two whitespaces>" or when editing a ticket when one of the possible milestones has two whitespaces. Its the exception from
cursor = db.cursor() cursor.execute(""" SELECT name,due,completed,description FROM milestone WHERE name=%s """, (name,)) row = cursor.fetchone() if not row: raise ResourceNotFound(_('Milestone %(name)s does not exist.', name=name), _('Invalid milestone name'))
both of the time.
For reproduction just manually insert a record with two whitespaces (or use an older version, or one without the normalization to insert it).
by , 15 years ago
Attachment: | fix_trac_edgewall_9275.patch added |
---|
comment:6 by , 15 years ago
Thanks for the additional info. Your patch, while fixing the retrieval, unfortunately removes whitespace normalization altogether. The correct behavior, as you mentioned, is probably to normalize when creating a new milestone / component / …
comment:8 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:9 by , 15 years ago
Owner: | changed from | to
---|
If wanted I can writeup a patch removing all the normalization uppon retrieval - its a trivial one though, so I am not sure its worth it.