Ticket #7084: t7084.diff

File t7084.diff, 1.9 KB (added by Ramiro Morales, 17 years ago)

My try at fixing this problem. Tested with the Django catalogs under WIndows and Linux.

  • django/bin/make-messages.py

    diff -r 679cddc80874 -r c5df431d7d18 django/bin/make-messages.py
    a b  
    8181        for dirpath, file in all_files:
    8282            if domain == 'djangojs' and file.endswith('.js'):
    8383                if verbose: sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
    84                 src = open(os.path.join(dirpath, file), "rb").read()
     84                src = open(os.path.join(dirpath, file), "rU").read()
    8585                src = pythonize_re.sub('\n#', src)
    86                 open(os.path.join(dirpath, '%s.py' % file), "wb").write(src)
     86                open(os.path.join(dirpath, '%s.py' % file), "wt").write(src)
    8787                thefile = '%s.py' % file
    8888                cmd = 'xgettext -d %s -L Perl --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % (domain, os.path.join(dirpath, thefile))
    8989                (stdin, stdout, stderr) = os.popen3(cmd, 't')
     
    107107            elif domain == 'django' and (file.endswith('.py') or file.endswith('.html')):
    108108                thefile = file
    109109                if file.endswith('.html'):
    110                     src = open(os.path.join(dirpath, file), "rb").read()
     110                    src = open(os.path.join(dirpath, file), "rU").read()
    111111                    thefile = '%s.py' % file
    112                     open(os.path.join(dirpath, thefile), "wb").write(templatize(src))
     112                    open(os.path.join(dirpath, thefile), "wt").write(templatize(src))
    113113                if verbose:
    114114                    sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
    115115                cmd = 'xgettext -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy:1,2 --keyword=ugettext_noop --keyword=ugettext_lazy --keyword=ungettext_lazy:1,2 --from-code UTF-8 -o - "%s"' % (
Back to Top