diff --git a/.travis.yml b/.travis.yml index b694508..da4ccc6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,4 +18,4 @@ deploy: password: $PYPASS on: tags: true - python: "3.5" \ No newline at end of file + python: "3.5" diff --git a/CHANGES.mD b/CHANGES.mD index 35f96e4..04d747c 100644 --- a/CHANGES.mD +++ b/CHANGES.mD @@ -1,6 +1,13 @@ Change logs === +## 2.0.0 - 22/10/2019 + +By @sonofmun + +- Minor changes to make Nemo compatible with MyCapytain 3.0.0 +- This version is no longer compatible with earlier versions of MyCapytain. Please upgrade to MyCapytain 3.0.0. + ## 1.0.4 - 22/10/2019 By @ponteineptique diff --git a/flask_nemo/__init__.py b/flask_nemo/__init__.py index 8bfef69..476ccaf 100644 --- a/flask_nemo/__init__.py +++ b/flask_nemo/__init__.py @@ -9,7 +9,8 @@ from urllib.parse import quote from operator import itemgetter from warnings import warn -from collections import Callable, OrderedDict +from collections import OrderedDict +from collections.abc import Callable from copy import deepcopy as copy from pkg_resources import resource_filename @@ -498,6 +499,7 @@ def expose_ancestors_or_children(self, member, collection, lang=None): x = { "id": member.id, "label": str(member.get_label(lang)), + "is_resource": isinstance(member, ResourceCollection), "model": str(member.model), "type": str(member.type), "size": member.size, diff --git a/flask_nemo/chunker.py b/flask_nemo/chunker.py index dfb1337..a3de8d7 100644 --- a/flask_nemo/chunker.py +++ b/flask_nemo/chunker.py @@ -14,7 +14,7 @@ def default_chunker(text, getreffs): :rtype: [(str, str)] """ level = len(text.citation) - return [tuple([reff.split(":")[-1]]*2) for reff in getreffs(level=level)] + return [tuple([str(reff)]*2) for reff in getreffs(level=level)] def scheme_chunker(text, getreffs): @@ -34,7 +34,7 @@ def scheme_chunker(text, getreffs): level = 2 elif types == ["book", "line"]: return line_chunker(text, getreffs) - return [tuple([reff.split(":")[-1]]*2) for reff in getreffs(level=level)] + return [tuple([str(reff)]*2) for reff in getreffs(level=level)] def line_chunker(text, getreffs, lines=30): @@ -50,7 +50,7 @@ def line_chunker(text, getreffs, lines=30): :rtype: [(str, str)] """ level = len(text.citation) - source_reffs = [reff.split(":")[-1] for reff in getreffs(level=level)] + source_reffs = [str(reff) for reff in getreffs(level=level)] reffs = [] i = 0 while i + lines - 1 < len(source_reffs): @@ -72,7 +72,7 @@ def level_chunker(text, getreffs, level=1): :rtype: [(str, str)] """ references = getreffs(level=level) - return [(ref.split(":")[-1], ref.split(":")[-1]) for ref in references] + return [(str(ref), str(ref)) for ref in references] def level_grouper(text, getreffs, level=None, groupby=20): @@ -87,7 +87,7 @@ def level_grouper(text, getreffs, level=None, groupby=20): if level is None or level > len(text.citation): level = len(text.citation) - references = [ref.split(":")[-1] for ref in getreffs(level=level)] + references = [str(ref) for ref in getreffs(level=level)] _refs = OrderedDict() for key in references: diff --git a/flask_nemo/data/templates/collection.html b/flask_nemo/data/templates/collection.html index bbf0a3c..520f6ed 100644 --- a/flask_nemo/data/templates/collection.html +++ b/flask_nemo/data/templates/collection.html @@ -14,7 +14,7 @@