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

Unified Diff: third_party/handlebar/handlebar.py

Issue 151773002: Docserver: Properly implement the Cron logic for ContentProvider and TemplateDataSource so that the… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: yoz + rebase Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/handlebar/handlebar.py
diff --git a/third_party/handlebar/handlebar.py b/third_party/handlebar/handlebar.py
index 7e06868e19380cfdcc4faa8c49f4620e4c0a5d1d..af561cadca5c60688f23b0c06bfe591e3b1251be 100644
--- a/third_party/handlebar/handlebar.py
+++ b/third_party/handlebar/handlebar.py
@@ -275,10 +275,11 @@ class _Identifier(object):
'''
_VALID_ID_MATCHER = re.compile(r'^[a-zA-Z0-9@_/-]+$')
- def __init__(self, name, line, column):
+ def __init__(self, name, line, column, title=None):
self.name = name
self.line = line
self.column = column
+ self._title = title
if name == '':
raise ParseException('Empty identifier %s' % self.GetDescription())
for part in name.split('.'):
@@ -286,7 +287,10 @@ class _Identifier(object):
raise ParseException('Invalid identifier %s' % self.GetDescription())
def GetDescription(self):
- return '\'%s\' at line %s column %s' % (self.name, self.line, self.column)
+ desc = '\'%s\' at line %s column %s' % (self.name, self.line, self.column)
+ if self._title is not None:
+ desc = '%s: %s' % (self._title, desc)
+ return desc
def CreateResolutionErrorMessage(self, name, stack=None):
message = _StringBuilder()
@@ -1040,7 +1044,7 @@ class Handlebar(object):
if clazz is not _UnescapedVariableNode:
name = name[1:]
column += 1
- inline_node = clazz(_Identifier(name, line, column))
+ inline_node = clazz(_Identifier(name, line, column, title=self._name))
if isinstance(inline_node, _PartialNode):
inline_node.SetArguments(self._ParsePartialNodeArgs(tokens))
if bind_to is not None:
@@ -1122,7 +1126,8 @@ class Handlebar(object):
column_start = tokens.next_column + 1
id_ = _Identifier(tokens.AdvanceOverNextString(excluded=' \n\r\t:()'),
tokens.next_line,
- column_start)
+ column_start,
+ title=self._name)
tokens.SkipWhitespace()
return id_

Powered by Google App Engine
This is Rietveld 408576698