Make conversation view not break when comment-id cannot be converted to long, fixes #13327

This commit is contained in:
Kees Hink
2012-11-14 13:25:10 +01:00
parent d46ca5e651
commit 6bd31ad490
4 changed files with 81 additions and 2 deletions
+5 -1
View File
@@ -210,7 +210,11 @@ class Conversation(Traversable, Persistent, Explicit):
def __getitem__(self, key):
"""Get an item by its long key
"""
return self._comments[long(key)].__of__(self)
try:
comment_id = long(key)
except ValueError:
return
return self._comments[comment_id].__of__(self)
def __delitem__(self, key, suppress_container_modified=False):
"""Delete an item by its long key