def run(document, editor=None, wait=True): if editor is not None: papis.config.set('editor', editor) database = papis.database.get() papis.utils.general_open(document.get_info_file(), "editor", wait=wait) document.load() database.update(document)
def test_query_dict(self): database = papis.database.get() doc = database.get_all_documents()[0] doc['author'] = 'test_query_dict' doc.save() database.update(doc) docs = database.query_dict({ 'title': doc['title'], 'author': doc['author'] }) self.assertTrue(len(docs) == 1)
def test_update(self): database = papis.database.get() doc = database.get_all_documents()[0] self.assertTrue(doc is not None) doc['title'] = 'test_update test' doc.save() database.update(doc) docs = database.query_dict({'title': 'test_update test'}) self.assertTrue(len(docs) == 1) doc = docs[0] self.assertTrue(doc is not None) self.assertTrue(doc['title'] == 'test_update test')
def run(document: papis.document.Document, wait: bool = True, git: bool = False) -> None: database = papis.database.get() info_file_path = document.get_info_file() if not info_file_path: raise Exception(papis.strings.no_folder_attached_to_document) papis.utils.general_open(info_file_path, "editor", wait=wait) document.load() database.update(document) if git: papis.git.add_and_commit_resource( str(document.get_main_folder()), info_file_path, "Update information for '{0}'".format( papis.document.describe(document)))
def run(document, wait=True): database = papis.database.get() papis.utils.general_open(document.get_info_file(), "editor", wait=wait) document.load() database.update(document)