cleaning up names / comments

This commit is contained in:
Matthias 2021-04-20 14:39:28 +02:00
parent 4d439db322
commit 99dc02e2cb
2 changed files with 7 additions and 7 deletions

View File

@ -28,14 +28,14 @@ class Command(BaseCommand):
""" """
def handle(self, *args, **kwargs): def handle(self, *args, **kwargs):
# static directorys # static directories
LC_DIR = settings.LOCALE_PATHS[0] LC_DIR = settings.LOCALE_PATHS[0]
SOURCE_DIR = settings.STATICFILES_I18_SRC SOURCE_DIR = settings.STATICFILES_I18_SRC
TARTGET_DIR = settings.STATICFILES_I18_TRG TARGET_DIR = settings.STATICFILES_I18_TRG
# ensure static directory exists # ensure static directory exists
if not os.path.exists(TARTGET_DIR): if not os.path.exists(TARGET_DIR):
os.mkdir(TARTGET_DIR) os.makedirs(TARGET_DIR, exist_ok=True)
# collect locales # collect locales
locales = {} locales = {}
@ -47,7 +47,7 @@ class Command(BaseCommand):
# render! # render!
request = HttpRequest() request = HttpRequest()
ctx = {} ctx = {}
processors = tuple(import_string(path) for path in settings.STATFILES_I18_PROCESORS) processors = tuple(import_string(path) for path in settings.STATFILES_I18_PROCESSORS)
for processor in processors: for processor in processors:
ctx.update(processor(request)) ctx.update(processor(request))
@ -55,7 +55,7 @@ class Command(BaseCommand):
path = os.path.join(SOURCE_DIR, file) path = os.path.join(SOURCE_DIR, file)
if os.path.exists(path) and os.path.isfile(path): if os.path.exists(path) and os.path.isfile(path):
print(f"render {file}") print(f"render {file}")
render_file(file, SOURCE_DIR, TARTGET_DIR, locales, ctx) render_file(file, SOURCE_DIR, TARGET_DIR, locales, ctx)
else: else:
raise NotImplementedError('Using multi-level directories is not implemented at this point') # TODO multilevel dir if needed raise NotImplementedError('Using multi-level directories is not implemented at this point') # TODO multilevel dir if needed
print(f"rendered all files in {SOURCE_DIR}") print(f"rendered all files in {SOURCE_DIR}")

View File

@ -197,7 +197,7 @@ STATICFILES_I18_TRG = STATICFILES_DIRS[0] + '_' + STATICFILES_I18_PREFIX
STATICFILES_DIRS.append(STATICFILES_I18_TRG) STATICFILES_DIRS.append(STATICFILES_I18_TRG)
STATICFILES_I18_TRG = os.path.join(STATICFILES_I18_TRG, STATICFILES_I18_PREFIX) STATICFILES_I18_TRG = os.path.join(STATICFILES_I18_TRG, STATICFILES_I18_PREFIX)
STATFILES_I18_PROCESORS = [ STATFILES_I18_PROCESSORS = [
'InvenTree.context.status_codes', 'InvenTree.context.status_codes',
] ]