Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: localeTools.py

Issue 29560569: Issue 5815 - Fixed Crowdin upload with non-ASCII characters (Closed)
Left Patch Set: Created Oct. 1, 2017, 2:37 a.m.
Right Patch Set: Put each argument on seperate line Created Oct. 1, 2017, 2:20 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # This Source Code Form is subject to the terms of the Mozilla Public 1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 4
5 import re 5 import re
6 import os 6 import os
7 import sys 7 import sys
8 import codecs 8 import codecs
9 import json 9 import json
10 import urlparse 10 import urlparse
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 body = '' 345 body = ''
346 for name, data in files: 346 for name, data in files:
347 body += ( 347 body += (
348 '--{boundary}\r\n' 348 '--{boundary}\r\n'
349 'Content-Disposition: form-data; name="files[{name}]"; ' 349 'Content-Disposition: form-data; name="files[{name}]"; '
350 'filename="{name}"\r\n' 350 'filename="{name}"\r\n'
351 'Content-Type: {mimetype}; charset=utf-8\r\n' 351 'Content-Type: {mimetype}; charset=utf-8\r\n'
352 'Content-Transfer-Encoding: binary\r\n' 352 'Content-Transfer-Encoding: binary\r\n'
353 '\r\n{data}\r\n' 353 '\r\n{data}\r\n'
354 '--{boundary}--\r\n' 354 '--{boundary}--\r\n'
355 ).format(boundary=boundary, name=name, 355 ).format(boundary=boundary,
Vasily Kuznetsov 2017/10/01 09:54:28 I would put `name` on a separate line as well, it'
Sebastian Noack 2017/10/01 14:20:54 Done.
356 name=name,
356 data=data.encode('utf-8'), 357 data=data.encode('utf-8'),
Sebastian Noack 2017/10/01 02:42:07 data is a unicode object. When passing any unicode
357 mimetype=mimetypes.guess_type(name)[0]) 358 mimetype=mimetypes.guess_type(name)[0])
Sebastian Noack 2017/10/01 02:42:07 Kinda unrelated, but since this line has to be wra
358 359
359 return ( 360 return (
360 StringIO(body), 361 StringIO(body),
361 { 362 {
362 'Content-Type': ('multipart/form-data; boundary=' + boundary), 363 'Content-Type': ('multipart/form-data; boundary=' + boundary),
363 'Content-Length': len(body) 364 'Content-Length': len(body)
364 }, 365 },
365 ) 366 )
366 367
367 368
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 505
505 # Remove any extra files 506 # Remove any extra files
506 for dir, files in dirs.iteritems(): 507 for dir, files in dirs.iteritems():
507 baseDir = os.path.join(localeConfig['base_path'], dir) 508 baseDir = os.path.join(localeConfig['base_path'], dir)
508 if not os.path.exists(baseDir): 509 if not os.path.exists(baseDir):
509 continue 510 continue
510 for file in os.listdir(baseDir): 511 for file in os.listdir(baseDir):
511 path = os.path.join(baseDir, file) 512 path = os.path.join(baseDir, file)
512 if os.path.isfile(path) and (file.endswith('.json') or file.endswith ('.properties') or file.endswith('.dtd')) and not file in files: 513 if os.path.isfile(path) and (file.endswith('.json') or file.endswith ('.properties') or file.endswith('.dtd')) and not file in files:
513 os.remove(path) 514 os.remove(path)
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld