Commit 815fe7bb authored by Taddeüs Kroes's avatar Taddeüs Kroes

Added xtension registration function

parent f281e9ab
...@@ -93,3 +93,23 @@ def filter_extensions(extensions): ...@@ -93,3 +93,23 @@ def filter_extensions(extensions):
compat.append(ext) compat.append(ext)
return compat return compat
"""
Class map used to find contructors for client-specified extensions. Not to be
modified manually, only through `register_extension`.
"""
extension_class_map = {}
def register_extension(ext):
if not isinstance(ext, Extension):
raise ValueError('extensions should extend the `Extension` class')
if ext.name in extension_clas_map:
raise KeyError('extension "%s" has already been registered' % ext.name)
extension_class_map[ext.name] = ext
register_extension(DeflateFrame)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment