Commit 65545216 authored by Michal Čihař's avatar Michal Čihař

Use iterator to lower memory usage

parent 296a25b8
...@@ -142,17 +142,19 @@ class SubProject(models.Model): ...@@ -142,17 +142,19 @@ class SubProject(models.Model):
# Glob files # Glob files
files = glob(os.path.join(self.get_path(), self.filemask)) files = glob(os.path.join(self.get_path(), self.filemask))
prefix = os.path.join(self.get_path(), '') prefix = os.path.join(self.get_path(), '')
files = [f.replace(prefix, '') for f in files] for f in files:
filename = f.replace(prefix, '')
# Get blobs for files yield (
return [(self.get_lang_code(f), f, tree[f]) for f in files] self.get_lang_code(filename),
filename,
tree[filename]
)
def create_translations(self, force = False): def create_translations(self, force = False):
''' '''
Loads translations from git. Loads translations from git.
''' '''
blobs = self.get_translation_blobs() for code, path, blob in self.get_translation_blobs():
for code, path, blob in blobs:
logger.info('checking %s', path) logger.info('checking %s', path)
Translation.objects.update_from_blob(self, code, path, blob, force) Translation.objects.update_from_blob(self, code, path, blob, force)
......
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