diff options
author | Leonard Richardson <leonardr@segfault.org> | 2019-07-07 16:24:41 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2019-07-07 16:24:41 -0400 |
commit | fd040bfacc6caa2d0b92edbeed5f32582ad55d83 (patch) | |
tree | 8a30058bb04d472cc457dec11b731a579b3c6201 /bs4/builder/__init__.py | |
parent | 0159c0a4135f267aed0586ba9d829d0a3da25da8 (diff) |
Renamed the cdata_list_attributes argument to multi_valued_attributes since it's facing the end-user and that's a more easily understandable name.
Diffstat (limited to 'bs4/builder/__init__.py')
-rw-r--r-- | bs4/builder/__init__.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/bs4/builder/__init__.py b/bs4/builder/__init__.py index 9dad920..c5e6e84 100644 --- a/bs4/builder/__init__.py +++ b/bs4/builder/__init__.py @@ -100,11 +100,23 @@ class TreeBuilder(object): USE_DEFAULT = object() - def __init__(self, cdata_list_attributes=USE_DEFAULT): + def __init__(self, multi_valued_attributes=USE_DEFAULT): + """Constructor. + + :param multi_valued_attributes: If this is set to None, the + TreeBuilder will not turn any values for attributes like + 'class' into lists. Setting this do a dictionary will + customize this behavior; look at DEFAULT_CDATA_LIST_ATTRIBUTES + for an example. + + Internally, these are called "CDATA list attributes", but that + probably doesn't make sense to an end-use, so the argument ame + is `multi_valued_attributes`. + """ self.soup = None - if cdata_list_attributes is self.USE_DEFAULT: - cdata_list_attributes = self.DEFAULT_CDATA_LIST_ATTRIBUTES - self.cdata_list_attributes = cdata_list_attributes + if multi_valued_attributes is self.USE_DEFAULT: + multi_valued_attributes = self.DEFAULT_CDATA_LIST_ATTRIBUTES + self.cdata_list_attributes = multi_valued_attributes def initialize_soup(self, soup): """The BeautifulSoup object has been initialized and is now |