예제 #1
0
 def has_cache(self):
     from citation_vim.utils import is_current
     if self.context.mode == 'bibtex':
         file_path = self.context.bibtex_file
     elif self.context.mode == 'zotero':
         zotero_database = os.path.join(self.context.zotero_path, u"zotero.sqlite")
         file_path = zotero_database
     return is_current(file_path, self.cache_file)
예제 #2
0
파일: data.py 프로젝트: rafaqz/citation.vim
 def __init__(self, context):
     self.context = context
     # Set paths
     self.storage_path = os.path.join(context.zotero_path, u"storage")
     self.zotero_database = os.path.join(context.zotero_path, u"zotero.sqlite")
     self.database_copy = os.path.join(context.cache_path, u"zotero.sqlite")
     # These dates are treated as special and are not parsed into a year
     # representation
     self.special_dates = u"in press", u"submitted", u"in preparation", \
         u"unpublished"
     # These extensions are recognized as fulltext attachments
     self.attachment_ext = u".pdf", u".ps", u".epub"
     self.index = {}
     self.collection_index = []
     self.ignored = []
     self.matches = []
     self.fulltext = False
     # Copy the zotero database to the copy
     if not is_current(self.zotero_database, self.database_copy):
         shutil.copyfile(self.zotero_database, self.database_copy)
     self.conn = sqlite3.connect(self.database_copy)
     self.cur = self.conn.cursor()
예제 #3
0
 def init_database(self):
     # Copy the zotero database
     if not is_current(self.zotero_database, self.database_copy):
         shutil.copyfile(self.zotero_database, self.database_copy)
     self.conn = sqlite3.connect(self.database_copy)
     self.cur = self.conn.cursor()