~leonardr/beautifulsoup/bs4

« back to all changes in this revision

Viewing changes to bs4/element.py

  • Committer: Leonard Richardson
  • Date: 2012-08-16 17:28:14 UTC
  • Revision ID: leonardr@segfault.org-20120816172814-mo8m1v24o4lab56c
As per PEP-8, allow searching by CSS class using the 'class_'
  keyword argument. [bug=1037624]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1170
1170
            kwargs['class'] = attrs
1171
1171
            attrs = None
1172
1172
 
 
1173
        if 'class_' in kwargs:
 
1174
            # Treat class_="foo" as a search for the 'class'
 
1175
            # attribute, overriding any non-dict value for attrs.
 
1176
            kwargs['class'] = kwargs['class_']
 
1177
            del kwargs['class_']
 
1178
 
1173
1179
        if kwargs:
1174
1180
            if attrs:
1175
1181
                attrs = attrs.copy()