mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Add new contentviews' content type mappings
This commit is contained in:
parent
82a90511bc
commit
d7239d665e
@ -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:
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user