Commit 179280e9 authored by Michal Čihař's avatar Michal Čihař

Use Weblate wrapper for template store as well

This makes the code more consistent.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 1acb7137
......@@ -561,7 +561,7 @@ class FileFormat(object):
def _find_unit_template(self, context):
# Need to create new unit based on template
template_ttkit_unit = self._find_unit_mono(
context, self.template_store
context, self.template_store.store
)
# We search by ID when using template
ttkit_unit = self._find_unit_mono(
......@@ -656,7 +656,7 @@ class FileFormat(object):
# Create wrapper object
yield self.unit_class(tt_unit)
else:
for template_unit in self.template_store.units:
for template_unit in self.template_store.store.units:
# Create wrapper object (not translated)
yield self.unit_class(
......@@ -671,7 +671,7 @@ class FileFormat(object):
if not self.has_template:
return len(self.store.units)
else:
return len(self.template_store.units)
return len(self.template_store.store.units)
@property
def mimetype(self):
......
......@@ -1397,7 +1397,7 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
"""Loads translate-toolkit store for template."""
return self.file_format_cls.parse(
self.get_template_filename(),
).store
)
@property
def template_store(self):
......
......@@ -667,7 +667,7 @@ class SubProjectEditTest(ViewTestCase):
def test_unit_disappear(self):
translation = self.subproject.translation_set.get(language_code='cs')
self.remove_units(self.subproject.template_store)
self.remove_units(self.subproject.template_store.store)
self.remove_units(translation.store.store)
# Clean class cache, pylint: disable=W0212
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment