Skip to content

Commit

Permalink
Add more conditional reading
Browse files Browse the repository at this point in the history
  • Loading branch information
PonteIneptique committed Mar 28, 2017
1 parent 0c9c4a6 commit 7769487
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions capitains_nautilus/cts/resolver.py
Expand Up @@ -103,9 +103,11 @@ def xmlparse(self, file):
:param file: Opened File
:return: Tree
"""
return self.get_or(
_cache_key("Nautilus", self.name, "File", "Tree", file.name), CTSCapitainsLocalResolver.xmlparse, self, file
)
if self.CACHE_FULL_TEI is True:
return self.get_or(
_cache_key("Nautilus", self.name, "File", "Tree", file.name), CTSCapitainsLocalResolver.xmlparse, self, file
)
return CTSCapitainsLocalResolver.xmlparse(self, file)

def get_or(self, cache_key, callback, *args, **kwargs):
""" Get or set the cache using callback and arguments
Expand Down Expand Up @@ -136,7 +138,7 @@ def read(self, identifier, path=None):
:param path: Path of the text files
:return: Text
"""
if self.CACHE_FULL_TEI:
if self.CACHE_FULL_TEI is True:
o = self.cache.get(_cache_key(self.texts_parsed_cache_key, identifier))
if o is not None:
return o
Expand Down

0 comments on commit 7769487

Please sign in to comment.