Modify ↓
Opened 5 years ago
Closed 5 years ago
#13284 closed task (fixed)
Skip ITicketManipulator.validate_comment when creating ticket
Reported by: | Ryan J Ollos | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.4.2 |
Component: | ticket system | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: |
Extension point method |
||
Internal Changes: |
Description
comment
is always None
when creating a ticket, so the interface method can be skipped.
-
trac/ticket/api.py
diff --git a/trac/ticket/api.py b/trac/ticket/api.py index 2dd633b6f..5ea9c96fb 100644
a b class ITicketManipulator(Interface): 166 166 compatibility.""" 167 167 168 168 def validate_ticket(req, ticket): 169 """Validate a ticket after it's been populated from user input.169 """Validate ticket properties when creating or modifying. 170 170 171 171 Must return a list of `(field, message)` tuples, one for each problem 172 172 detected. `field` can be `None` to indicate an overall problem with the 173 173 ticket. Therefore, a return value of `[]` means everything is OK.""" 174 174 175 175 def validate_comment(req, comment): 176 """Validate ticket comment after it has been edited.176 """Validate ticket comment when appending or editing. 177 177 178 178 Must return a list of messages, one for each problem detected. 179 179 The return value `[]` indicates no problems. -
trac/ticket/web_ui.py
diff --git a/trac/ticket/web_ui.py b/trac/ticket/web_ui.py index 53b70d454..f25b1d218 100644
a b class TicketModule(Component): 1330 1330 # Validate custom rules. 1331 1331 comment = comment or req.args.get('edited_comment') 1332 1332 for manipulator in self.ticket_manipulators: 1333 if hasattr(manipulator, 'validate_comment'):1333 if ticket.exists and hasattr(manipulator, 'validate_comment'): 1334 1334 for message in manipulator.validate_comment(req, comment): 1335 1335 valid = False 1336 1336 add_warning(req, tag_("The ticket comment is invalid: "
Attachments (0)
Note:
See TracTickets
for help on using tickets.
Proposed changes in [b1b368d9c/rjollos.git].