Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

activitypub.Collection.items incorrect logic? #289

Open
steve-bate opened this issue Aug 1, 2024 · 0 comments
Open

activitypub.Collection.items incorrect logic? #289

steve-bate opened this issue Aug 1, 2024 · 0 comments

Comments

@steve-bate
Copy link
Member

The first and next variables are compared to None and set to a bool value. The isinstance(..., str) looks like it will never succeed (based on my testing).

    def items(self) -> Iterator[AnyObject]:
        items = self._delegate.json_field('orderedItems' if self.is_ordered() else 'items')
        if items is not None:
# ...
        elif first := self._delegate.json_field('first') is not None: # <-- first will always be a bool
            if isinstance(first,str): # <-- is never true?
                first_collection = AnyObject(first).as_collection()
                yield from first_collection.items()
            else:
                raise Exception(f'Cannot process yet: {first}')
        elif next := self._delegate.json_field('next') is not None:
            # similar issue for next ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants