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

Side by Side Diff: cms/converters.py

Issue 29324494: Issue 2935 - Give get_string page parameter a sensible default value (Closed)
Patch Set: Created Aug. 20, 2015, 8:51 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2015 Eyeo GmbH 4 # Copyright (C) 2006-2015 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 result = unicode(module) 355 result = unicode(module)
356 result = self.process_links(result) 356 result = self.process_links(result)
357 return result 357 return result
358 358
359 def translate(self, default, name, comment=None): 359 def translate(self, default, name, comment=None):
360 return jinja2.Markup(self.localize_string( 360 return jinja2.Markup(self.localize_string(
361 self._params["page"], name, default, comment, 361 self._params["page"], name, default, comment,
362 self._params["localedata"], html_escapes 362 self._params["localedata"], html_escapes
363 )) 363 ))
364 364
365 def get_string(self, name, page): 365 def get_string(self, name, page=None):
366 if page is None:
367 page = self._params["page"]
368
366 localedata = self._params["source"].read_locale(self._params["locale"], page ) 369 localedata = self._params["source"].read_locale(self._params["locale"], page )
367 default = localedata[name] 370 default = localedata[name]
368 return jinja2.Markup(self.localize_string( 371 return jinja2.Markup(self.localize_string(
369 page, name, default, "", localedata, html_escapes 372 page, name, default, "", localedata, html_escapes
370 )) 373 ))
371 374
372 def get_page_content(self, page, locale=None): 375 def get_page_content(self, page, locale=None):
373 from cms.utils import get_page_params 376 from cms.utils import get_page_params
374 377
375 if locale is None: 378 if locale is None:
(...skipping 29 matching lines...) Expand all
405 stack.pop() 408 stack.pop()
406 stack[-1]["subitems"].append(item) 409 stack[-1]["subitems"].append(item)
407 stack.append(item) 410 stack.append(item)
408 return structured 411 return structured
409 412
410 converters = { 413 converters = {
411 "html": RawConverter, 414 "html": RawConverter,
412 "md": MarkdownConverter, 415 "md": MarkdownConverter,
413 "tmpl": TemplateConverter, 416 "tmpl": TemplateConverter,
414 } 417 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld