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

Subscription lists having outlines without their created_at attribute fail to be merged on Python 3 #65

Closed
teddychoi opened this issue Oct 25, 2014 · 1 comment

Comments

@teddychoi
Copy link
Member

Regression test

def test_put_headless_opml_to_stage(fx_headless_subscription_list, fx_stages):
    stage, _ = fx_stages
    with stage:
        stage.subscriptions = fx_headless_subscription_list
        read_subscriptions = stage.subscriptions
        stage.subscriptions = read_subscriptions

Traceback

fx_headless_subscription_list = <libearth.subscribe.SubscriptionList object at 0x10391d0e0>
fx_stages = (libearth.stage.Stage(libearth.session.Session('SESSID'), tests.stage_test.MemoryRepository()), libearth.stage.Stage(libearth.session.Session('SESSID2'), tests.stage_test.MemoryRepository()))

    def test_put_headless_opml_to_stage(fx_headless_subscription_list, fx_stages):
        stage, _ = fx_stages
        with stage:
            stage.subscriptions = fx_headless_subscription_list
            read_subscriptions = stage.subscriptions
>           stage.subscriptions = read_subscriptions

tests/subscribe_test.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
libearth/stage.py:623: in __set__
    obj.write(key, value)
libearth/stage.py:344: in write
    document = self.session.merge(prev_doc, document, force=True)
libearth/session.py:190: in merge
    merged = a.__merge_entities__(b)
libearth/subscribe.py:520: in __merge_entities__
    subs = SubscriptionSet.__merge_entities__(self, other)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <libearth.subscribe.SubscriptionList object at 0x1039bb170>
other = <libearth.subscribe.SubscriptionList object at 0x10392ab00>

    def __merge_entities__(self, other):
        for outline in other.children:
            for child in self.children:
                if child == outline:
                    if type(child) is Outline:
                        child.__class__ = (Subscription
                                           if child.type == 'rss'
                                           else Category)
                        outline._title = outline.label
                    child.created_at = max(child.created_at,
>                                          outline.created_at)
E                   TypeError: unorderable types: NoneType() > NoneType()
@dahlia
Copy link
Contributor

dahlia commented Oct 25, 2014

It actually is not related to whether a subscription list is headless or having its head, but whether an outline has its created_at attribute.

@dahlia dahlia changed the title Headless OPML raises bug when merged in Python3 Subscription lists having outlines without their created_at attribute fail to be merged on Python 3 Oct 25, 2014
dahlia added a commit that referenced this issue Oct 25, 2014
@dahlia dahlia closed this as completed in 55a3a04 Nov 4, 2014
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