summaryrefslogtreecommitdiff
path: root/beautifulsoup/builder/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'beautifulsoup/builder/__init__.py')
-rw-r--r--beautifulsoup/builder/__init__.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/beautifulsoup/builder/__init__.py b/beautifulsoup/builder/__init__.py
index d6c750c..5e55f7f 100644
--- a/beautifulsoup/builder/__init__.py
+++ b/beautifulsoup/builder/__init__.py
@@ -1,4 +1,5 @@
import re
+import sys
from beautifulsoup.element import Entities
__all__ = [
@@ -163,5 +164,21 @@ class HTMLTreeBuilder(TreeBuilder):
pass
return False
-from _lxml import *
-from _html5lib import *
+
+def register_builders_from(module):
+ # I'm fairly sure this is not the best way to do this.
+
+ # Copy everything mentioned in the builder module's __all__ into
+ # this module.
+ this_module = sys.modules[__package__]
+ for name in module.__all__:
+ setattr(this_module, name, getattr(module, name))
+
+ # Add all names from the builder module's __all__ to this module's
+ # __all__.
+ this_module.__all__ += module.__all__
+
+import _lxml
+register_builders_from(_lxml)
+import _html5lib
+register_builders_from(_html5lib)