Commit 28f22393 by David Baumgold

whitespace-only changes

parent c8416451
...@@ -28,6 +28,7 @@ MAX_SCORE = 1 ...@@ -28,6 +28,7 @@ MAX_SCORE = 1
FILE_NOT_FOUND_IN_RESPONSE_MESSAGE = "We could not find a file in your submission. Please try choosing a file or pasting a link to your file into the answer box." FILE_NOT_FOUND_IN_RESPONSE_MESSAGE = "We could not find a file in your submission. Please try choosing a file or pasting a link to your file into the answer box."
ERROR_SAVING_FILE_MESSAGE = "We are having trouble saving your file. Please try another file or paste a link to your file into the answer box." ERROR_SAVING_FILE_MESSAGE = "We are having trouble saving your file. Please try another file or paste a link to your file into the answer box."
def upload_to_s3(file_to_upload, keyname, s3_interface): def upload_to_s3(file_to_upload, keyname, s3_interface):
''' '''
Upload file to S3 using provided keyname. Upload file to S3 using provided keyname.
......
...@@ -21,6 +21,7 @@ from execute import execute ...@@ -21,6 +21,7 @@ from execute import execute
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
def merge(locale, target='django.po', fail_if_missing=True): def merge(locale, target='django.po', fail_if_missing=True):
""" """
For the given locale, merge django-partial.po, messages.po, mako.po -> django.po For the given locale, merge django-partial.po, messages.po, mako.po -> django.po
...@@ -52,6 +53,7 @@ def merge(locale, target='django.po', fail_if_missing=True): ...@@ -52,6 +53,7 @@ def merge(locale, target='django.po', fail_if_missing=True):
django_filename = locale_directory.joinpath(target) django_filename = locale_directory.joinpath(target)
os.rename(merged_filename, django_filename) # can't overwrite file on Windows os.rename(merged_filename, django_filename) # can't overwrite file on Windows
def clean_metadata(file): def clean_metadata(file):
""" """
Clean up redundancies in the metadata caused by merging. Clean up redundancies in the metadata caused by merging.
...@@ -59,6 +61,7 @@ def clean_metadata(file): ...@@ -59,6 +61,7 @@ def clean_metadata(file):
""" """
pofile(file).save() pofile(file).save()
def validate_files(dir, files_to_merge): def validate_files(dir, files_to_merge):
""" """
Asserts that the given files exist. Asserts that the given files exist.
...@@ -71,7 +74,8 @@ def validate_files(dir, files_to_merge): ...@@ -71,7 +74,8 @@ def validate_files(dir, files_to_merge):
if not pathname.exists(): if not pathname.exists():
raise Exception("I18N: Cannot generate because file not found: {0}".format(pathname)) raise Exception("I18N: Cannot generate because file not found: {0}".format(pathname))
def main ():
def main():
logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.basicConfig(stream=sys.stdout, level=logging.INFO)
for locale in CONFIGURATION.locales: for locale in CONFIGURATION.locales:
...@@ -81,5 +85,6 @@ def main (): ...@@ -81,5 +85,6 @@ def main ():
compile_cmd = 'django-admin.py compilemessages' compile_cmd = 'django-admin.py compilemessages'
execute(compile_cmd, working_directory=BASE_DIR) execute(compile_cmd, working_directory=BASE_DIR)
if __name__ == '__main__': if __name__ == '__main__':
main() main()
...@@ -28,6 +28,7 @@ from dummy import Dummy ...@@ -28,6 +28,7 @@ from dummy import Dummy
from config import CONFIGURATION from config import CONFIGURATION
from execute import create_dir_if_necessary from execute import create_dir_if_necessary
def main(file, locale): def main(file, locale):
""" """
Takes a source po file, reads it, and writes out a new po file Takes a source po file, reads it, and writes out a new po file
...@@ -44,6 +45,7 @@ def main(file, locale): ...@@ -44,6 +45,7 @@ def main(file, locale):
create_dir_if_necessary(new_file) create_dir_if_necessary(new_file)
pofile.save(new_file) pofile.save(new_file)
def new_filename(original_filename, new_locale): def new_filename(original_filename, new_locale):
"""Returns a filename derived from original_filename, using new_locale as the locale""" """Returns a filename derived from original_filename, using new_locale as the locale"""
orig_dir = os.path.dirname(original_filename) orig_dir = os.path.dirname(original_filename)
...@@ -57,10 +59,10 @@ def new_filename(original_filename, new_locale): ...@@ -57,10 +59,10 @@ def new_filename(original_filename, new_locale):
if __name__ == '__main__': if __name__ == '__main__':
# required arg: file # required arg: file
if len(sys.argv)<2: if len(sys.argv) < 2:
raise Exception("missing file argument") raise Exception("missing file argument")
# optional arg: locale # optional arg: locale
if len(sys.argv)<3: if len(sys.argv) < 3:
locale = CONFIGURATION.get_dummy_locale() locale = CONFIGURATION.get_dummy_locale()
else: else:
locale = sys.argv[2] locale = sys.argv[2]
......
...@@ -51,4 +51,4 @@ MIDDLEWARE_CLASSES = tuple([mcl for mcl in MIDDLEWARE_CLASSES if not mcl.startsw ...@@ -51,4 +51,4 @@ MIDDLEWARE_CLASSES = tuple([mcl for mcl in MIDDLEWARE_CLASSES if not mcl.startsw
TEMPLATE_LOADERS = ( TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader', 'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader', 'django.template.loaders.app_directories.Loader',
) )
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