rename also rename notes
This commit is contained in:
parent
1ad64d7859
commit
29897cc0ad
@ -35,7 +35,7 @@ class DataBroker(object):
|
|||||||
|
|
||||||
def push(self, citekey, metadata, bibdata):
|
def push(self, citekey, metadata, bibdata):
|
||||||
self.filebroker.push(citekey, metadata, bibdata)
|
self.filebroker.push(citekey, metadata, bibdata)
|
||||||
|
|
||||||
def remove(self, citekey):
|
def remove(self, citekey):
|
||||||
self.filebroker.remove(citekey)
|
self.filebroker.remove(citekey)
|
||||||
|
|
||||||
@ -65,11 +65,17 @@ class DataBroker(object):
|
|||||||
def real_docpath(self, docpath):
|
def real_docpath(self, docpath):
|
||||||
return self.docbroker.real_docpath(docpath)
|
return self.docbroker.real_docpath(docpath)
|
||||||
|
|
||||||
|
|
||||||
# notesbroker
|
# notesbroker
|
||||||
|
|
||||||
def in_notesdir(self, docpath):
|
def in_notesdir(self, docpath):
|
||||||
return self.notebroker.in_docsdir(docpath)
|
return self.notebroker.in_docsdir(docpath)
|
||||||
|
|
||||||
|
def copy_note(self, citekey, source_path, overwrite=False):
|
||||||
|
return self.notebroker.copy_doc(citekey, source_path, overwrite=overwrite)
|
||||||
|
|
||||||
|
def remove_note(self, docpath, silent=True):
|
||||||
|
return self.notebroker.remove_doc(docpath, silent=silent)
|
||||||
|
|
||||||
|
|
||||||
def real_notepath(self, docpath):
|
def real_notepath(self, docpath):
|
||||||
return self.notebroker.real_docpath(docpath)
|
return self.notebroker.real_docpath(docpath)
|
@ -79,6 +79,12 @@ class DataCache(object):
|
|||||||
def in_notesdir(self, docpath):
|
def in_notesdir(self, docpath):
|
||||||
return self.databroker.in_notesdir(docpath)
|
return self.databroker.in_notesdir(docpath)
|
||||||
|
|
||||||
|
def copy_note(self, citekey, source_path, overwrite=False):
|
||||||
|
return self.databroker.copy_note(citekey, source_path, overwrite=overwrite)
|
||||||
|
|
||||||
|
def remove_note(self, docpath, silent=True):
|
||||||
|
return self.databroker.remove_note(docpath, silent=silent)
|
||||||
|
|
||||||
def real_notepath(self, docpath):
|
def real_notepath(self, docpath):
|
||||||
return self.databroker.real_notepath(docpath)
|
return self.databroker.real_notepath(docpath)
|
||||||
|
|
||||||
|
@ -126,6 +126,9 @@ class DocBroker(object):
|
|||||||
return False
|
return False
|
||||||
return parsed.scheme == self.scheme
|
return parsed.scheme == self.scheme
|
||||||
|
|
||||||
|
# def doc_exists(self, citekey, ext='.txt'):
|
||||||
|
# return check_file(os.path.join(self.docdir, citekey + ext), fail=False)
|
||||||
|
|
||||||
def copy_doc(self, citekey, source_path, overwrite=False):
|
def copy_doc(self, citekey, source_path, overwrite=False):
|
||||||
""" Copy a document to the pubsdir/doc, and return the location
|
""" Copy a document to the pubsdir/doc, and return the location
|
||||||
|
|
||||||
|
@ -114,6 +114,14 @@ class Repository(object):
|
|||||||
self.databroker.remove_doc(paper.docpath)
|
self.databroker.remove_doc(paper.docpath)
|
||||||
paper.docpath = new_docpath
|
paper.docpath = new_docpath
|
||||||
|
|
||||||
|
try:
|
||||||
|
old_notepath = 'notesdir://{}.txt'.format(old_citekey)
|
||||||
|
new_notepath = self.databroker.copy_note(new_citekey, old_notepath)
|
||||||
|
self.databroker.remove_notei(old_notepath)
|
||||||
|
except IOError:
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
# push_paper to new_citekey
|
# push_paper to new_citekey
|
||||||
paper.citekey = new_citekey
|
paper.citekey = new_citekey
|
||||||
self.push_paper(paper, event=False)
|
self.push_paper(paper, event=False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user