Example #1
0
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)
Example #2
0
 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)
Example #3
0
 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')
Example #4
0
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)))
Example #5
0
File: edit.py Project: mczuba/papis
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)