Export qof_book_mark_session_dirty to the Python bindings.#2090
Open
rotdrop wants to merge 1 commit intoGnucash:stablefrom
Open
Export qof_book_mark_session_dirty to the Python bindings.#2090rotdrop wants to merge 1 commit intoGnucash:stablefrom
rotdrop wants to merge 1 commit intoGnucash:stablefrom
Conversation
Use case: implement a command line "save-as" script. This works by using the gnucash_core_c bindings like follows but for the problem that qof_book_mark_session_dirty() is not exported, and without "dirty" the function `qof_session_save(outputSession)` does nothing. ``` ... inputSession = gnucash_core_c.qof_session_new(gnucash_core_c.qof_book_new()) gnucash_core_c.qof_session_begin(inputSession, inputURI, SessionOpenMode.SESSION_READ_ONLY) gnucash_core_c.qof_session_load(inputSession, None) outputSession = gnucash_core_c.qof_session_new(gnucash_core_c.qof_book_new()) gnucash_core_c.qof_session_begin(outputSession, outputURI, SessionOpenMode.SESSION_NEW_OVERWRITE) gnucash_core_c.qof_session_swap_data(inputSession, outputSession) gnucash_core_c.qof_book_mark_session_dirty(gnucash_core_c.qof_session_get_book(outputSession)) gnucash_core_c.qof_session_save(outputSession, None) gnucash_core_c.qof_session_end(outputSession) ``` Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
Author
|
There is also an older related thread by someone else on them mailing list: https://lists.gnucash.org/pipermail/gnucash-user/2018-June/077649.html |
Member
|
Please add a test or two to exercise this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use case: implement a command line "save-as" script. This works by using the gnucash_core_c bindings like follows but for the problem that qof_book_mark_session_dirty() is not exported, and without "dirty" the function
qof_session_save(outputSession)does nothing.Complete script is here https://github.com/rotdrop/gnucash-python/blob/main/src/save-as.py