Skip to content

Commit

Permalink
cleaning up names / comments
Browse files Browse the repository at this point in the history
  • Loading branch information
matmair committed Apr 20, 2021
1 parent 4d439db commit 99dc02e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions InvenTree/InvenTree/management/commands/prerender.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ class Command(BaseCommand):
"""

def handle(self, *args, **kwargs):
# static directorys
# static directories
LC_DIR = settings.LOCALE_PATHS[0]
SOURCE_DIR = settings.STATICFILES_I18_SRC
TARTGET_DIR = settings.STATICFILES_I18_TRG
TARGET_DIR = settings.STATICFILES_I18_TRG

# ensure static directory exists
if not os.path.exists(TARTGET_DIR):
os.mkdir(TARTGET_DIR)
if not os.path.exists(TARGET_DIR):
os.makedirs(TARGET_DIR, exist_ok=True)

# collect locales
locales = {}
Expand All @@ -47,15 +47,15 @@ def handle(self, *args, **kwargs):
# render!
request = HttpRequest()
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:
ctx.update(processor(request))

for file in os.listdir(SOURCE_DIR, ):
path = os.path.join(SOURCE_DIR, file)
if os.path.exists(path) and os.path.isfile(path):
print(f"render {file}")
render_file(file, SOURCE_DIR, TARTGET_DIR, locales, ctx)
render_file(file, SOURCE_DIR, TARGET_DIR, locales, ctx)
else:
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}")
2 changes: 1 addition & 1 deletion InvenTree/InvenTree/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def get_setting(environment_var, backup_val, default_value=None):
STATICFILES_DIRS.append(STATICFILES_I18_TRG)
STATICFILES_I18_TRG = os.path.join(STATICFILES_I18_TRG, STATICFILES_I18_PREFIX)

STATFILES_I18_PROCESORS = [
STATFILES_I18_PROCESSORS = [
'InvenTree.context.status_codes',
]

Expand Down

0 comments on commit 99dc02e

Please sign in to comment.