beatonma/django-wm

HCards only being found if they're the first item in the soup

Closed this issue · 0 comments

The HCard.from_soup() method tries to loop through all of the items that mf2py has found in the page source:

        for item in parsed_data.get("items", []):
            try:
                return _parse_hcard(item, save)
            except NotEnoughData as e:
                log.debug(e)
                continue

But this currently results in it giving up after the first item, if that wasn't an h-card that generated a NotEnoughData exception.

e.g. if there are two items found, an h-entry and then an h-card, _parse_hcard() will return None when it looks at the h-entry, and so from_soup() will immediately do the same, before it can send the h-card to _parse_hcard().