Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: chrome/common/extensions/docs/server2/converter.py

Issue 10830252: Extensions Docs Server: Uniform handling of file not found errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better error handling/slight template fix to pass integration_test Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # Example run from the server2/ directory: 6 # Example run from the server2/ directory:
7 # $ converter.py ../static/ ../../api templates/articles/ templates/intros/ 7 # $ converter.py ../static/ ../../api templates/articles/ templates/intros/
8 # templates/public/ static/images/ -r 8 # templates/public/ static/images/ -r
9 9
10 import json 10 import json
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 static_data = None 296 static_data = None
297 for path in _GetDestinations(processed_name, api_dir): 297 for path in _GetDestinations(processed_name, api_dir):
298 template_file = os.path.join(template_dest, path, processed_name + '.html') 298 template_file = os.path.join(template_dest, path, processed_name + '.html')
299 if is_api: 299 if is_api:
300 template_data = _MakeAPITemplate(processed_name, 300 template_data = _MakeAPITemplate(processed_name,
301 path, 301 path,
302 _GetAPIPath(unix_name, api_dir), 302 _GetAPIPath(unix_name, api_dir),
303 static_data is not None) 303 static_data is not None)
304 static_file = os.path.join(intros_dest, processed_name + '.html') 304 static_file = os.path.join(intros_dest, processed_name + '.html')
305 else: 305 else:
306 template_data = _MakeArticleTemplate(unix_name, path) 306 template_data = _MakeArticleTemplate(processed_name, path)
307 static_file = os.path.join(articles_dest, processed_name + '.html') 307 static_file = os.path.join(articles_dest, processed_name + '.html')
308 if replace or not os.path.exists(template_file): 308 if replace or not os.path.exists(template_file):
309 _WriteFile(template_file, template_data) 309 _WriteFile(template_file, template_data)
310 if svn: 310 if svn:
311 subprocess.call(['svn', 311 subprocess.call(['svn',
312 'add', 312 'add',
313 '--force', 313 '--force',
314 '--parents', 314 '--parents',
315 '-q', 315 '-q',
316 template_file]) 316 template_file])
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 if (not opts.file and len(args) != 6) or (opts.file and len(args) != 7): 354 if (not opts.file and len(args) != 6) or (opts.file and len(args) != 7):
355 parser.error('incorrect number of arguments.') 355 parser.error('incorrect number of arguments.')
356 356
357 if opts.file: 357 if opts.file:
358 _MoveSingleFile(*args, replace=opts.replace, svn=opts.svn) 358 _MoveSingleFile(*args, replace=opts.replace, svn=opts.svn)
359 else: 359 else:
360 _MoveAllFiles(*args, 360 _MoveAllFiles(*args,
361 replace=opts.replace, 361 replace=opts.replace,
362 exclude_dir=opts.exclude, 362 exclude_dir=opts.exclude,
363 svn=opts.svn) 363 svn=opts.svn)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698