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

Unified Diff: chrome/common/extensions/docs/server2/docs_server_utils.py

Issue 375133002: Docserver: Display API features that are available to content scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 6 years, 5 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: 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.
« no previous file with comments | « chrome/common/extensions/docs/server2/cron.yaml ('k') | chrome/common/extensions/docs/server2/features_bundle.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698