Index: chrome/common/extensions/docs/server2/docs_server_utils.py |
diff --git a/chrome/common/extensions/docs/server2/docs_server_utils.py b/chrome/common/extensions/docs/server2/docs_server_utils.py |
index f81370f84df78339051e8682abe4d9af2b2c0939..7fe962e7a977121920ca381408bb7ee76fde59d9 100644 |
--- a/chrome/common/extensions/docs/server2/docs_server_utils.py |
+++ b/chrome/common/extensions/docs/server2/docs_server_utils.py |
@@ -33,12 +33,24 @@ def StringIdentity(first, *more): |
identity = encode(identity + m) |
return identity[:8] |
+def MarkFirst(dicts): |
+ '''Adds a property 'first' == True to the first element in a list of dicts. |
+ ''' |
+ if len(dicts) > 0: |
+ dicts[0]['first'] = True |
+ |
def MarkLast(dicts): |
'''Adds a property 'last' == True to the last element in a list of dicts. |
''' |
if len(dicts) > 0: |
dicts[-1]['last'] = True |
+def MarkFirstAndLast(dicts): |
+ '''Marks the first and last element in a list of dicts. |
+ ''' |
+ MarkFirst(dicts) |
+ MarkLast(dicts) |
+ |
def ToUnicode(data): |
'''Returns the str |data| as a unicode object. It's expected to be utf8, but |
there are also latin-1 encodings in there for some reason. Fall back to that. |