Add new contentviews' content type mappings

This commit is contained in:
Chris Czub 2015-11-09 15:07:08 -05:00
parent 82a90511bc
commit d7239d665e
2 changed files with 11 additions and 0 deletions

View File

@ -520,8 +520,18 @@ def add(obj):
if i.name == obj.name: if i.name == obj.name:
raise ContentViewException("Duplicate view: " + obj.name) raise ContentViewException("Duplicate view: " + obj.name)
for prompt in view_prompts:
if prompt[1] == obj.prompt[1]:
raise ContentViewException("Duplicate view shortcut: " + obj.prompt[1])
views.append(obj) views.append(obj)
for ct in obj.content_types:
l = content_types_map.setdefault(ct, [])
l.append(obj)
view_prompts.append(obj.prompt)
def get(name): def get(name):
for i in views: for i in views:

View File

@ -217,6 +217,7 @@ Larry
tcv = TestContentView() tcv = TestContentView()
cv.add(tcv) cv.add(tcv)
# repeated addition causes exception
tutils.raises( tutils.raises(
ContentViewException, ContentViewException,
cv.add, cv.add,