Skip to content
Browse files

Fix an error which throws away incoming data on preview

  • Loading branch information...
1 parent f7e4683 commit a0fc153798aeea37c64ed88760560f855fdc4c16 @itota committed Oct 28, 2012
Showing with 13 additions and 9 deletions.
  1. +1 −1 tracsubtickets/api.py
  2. +12 −8 tracsubtickets/web_ui.py
View
2 tracsubtickets/api.py
@@ -215,7 +215,7 @@ def _check_parents(id, all_parents):
errors += _check_parents(x, all_parents)
return errors
- for x in _ids:
+ for x in [i for i in _ids if i not in invalid_ids]:
# check parent ticket state
try:
parent = Ticket(self.env, x)
View
20 tracsubtickets/web_ui.py
@@ -32,6 +32,7 @@
from trac.web.chrome import ITemplateProvider, add_stylesheet
from trac.ticket.api import ITicketManipulator
from trac.ticket.model import Ticket
+from trac.resource import ResourceNotFound
from genshi.builder import tag
from genshi.filters import Transformer
@@ -78,14 +79,17 @@ def post_process_request(self, req, template, data, content_type):
def _append_parent_links(self, req, data, ids):
links = []
for id in sorted(ids, key=lambda x: int(x)):
- ticket = Ticket(self.env, id)
- elem = tag.a('#%s' % id,
- href=req.href.ticket(id),
- class_='%s ticket' % ticket['status'],
- title=ticket['summary'])
- if len(links) > 0:
- links.append(', ')
- links.append(elem)
+ try:
+ ticket = Ticket(self.env, id)
+ elem = tag.a('#%s' % id,
+ href=req.href.ticket(id),
+ class_='%s ticket' % ticket['status'],
+ title=ticket['summary'])
+ if len(links) > 0:
+ links.append(', ')
+ links.append(elem)
+ except ResourceNotFound, e:
+ pass
for field in data.get('fields', ''):
if field.get('name') == 'parents':
field['rendered'] = tag.span(*links)

0 comments on commit a0fc153

Please sign in to comment.
Something went wrong with that request. Please try again.