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

Fix republishing of binders with trees latest flag set to null #131

Merged
merged 1 commit into from
Jul 1, 2016

Commits on Jun 30, 2016

  1. Fix republishing of binders with trees latest flag set to null

    Binders published using cnx-publishing (at the time of writing) always
    have trees latest flag set to true, but there are lots of binders in the
    database with trees latest flag set to null.  The code for republishing
    a binder doesn't use the new module_ident / documentid when inserting
    into the trees table, causing this error.
    
    ```
    ======================================================================
    ERROR: test_republish_binder_tree_not_latest (cnxpublishing.tests.test_publish.RepublishTestCase)
    Verify republishing of binders that has trees with latest flag set
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/karen/cnx-publishing/cnxpublishing/tests/testing.py", line 66, in wrapped
        return method(self, cursor, *args, **kwargs)
      File "/home/karen/cnx-publishing/cnxpublishing/tests/test_publish.py", line 612, in test_republish_binder_tree_not_latest
        self.call_target(cursor, [page_one])
      File "/home/karen/cnx-publishing/cnxpublishing/tests/test_publish.py", line 497, in call_target
        return republish_binders(*args, **kwargs)
      File "/home/karen/cnx-publishing/cnxpublishing/publish.py", line 506, in republish_binders
        rebuild_collection_tree(cursor, ident_hash, history_mapping)
      File "/home/karen/cnx-publishing/cnxpublishing/publish.py", line 688, in rebuild_collection_tree
        build_tree(root_node, None)
      File "/home/karen/cnx-publishing/cnxpublishing/publish.py", line 683, in build_tree
        new_nodeid = insert(data)
      File "/home/karen/cnx-publishing/cnxpublishing/publish.py", line 664, in insert
        cursor.execute(tree_insert_sql, fields)
    IntegrityError: duplicate key value violates unique constraint "trees_unique_doc_idx"
    DETAIL:  Key (documentid, is_collated)=(5, f) already exists.
    ```
    karenc committed Jun 30, 2016
    Configuration menu
    Copy the full SHA
    211d6c8 View commit details
    Browse the repository at this point in the history