summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--beautifulsoup/builder/__init__.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/beautifulsoup/builder/__init__.py b/beautifulsoup/builder/__init__.py
index 3983d66..1ece168 100644
--- a/beautifulsoup/builder/__init__.py
+++ b/beautifulsoup/builder/__init__.py
@@ -165,19 +165,8 @@ class HTMLTreeBuilder(TreeBuilder):
return False
-def register_builders_from(module_name, add_to_all,
- local_to_this_package=False):
- # I'm sure this is not the best way to do this.
-
- # Import the module beautifulsoup.builder.foo or some.other.builder.foo
- if local_to_this_package:
- fqn = __package__ + '.' + module_name
- else:
- fqn = module_name
- __import__(fqn)
-
- # Look up the module by its fully-qualified name.
- module = sys.modules[fqn]
+def register_builders_from(module, add_to_all)
+ # 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.
@@ -188,5 +177,7 @@ def register_builders_from(module_name, add_to_all,
# Add all names from the builder module's __all__ to these names.
add_to_all += module.__all__
-register_builders_from('_lxml', __all__, True)
-register_builders_from('_html5lib', __all__, True)
+import _lxml
+register_builders_from(_lxml, __all__)
+import html5lib
+register_builders_from(_html5lib, __all__)