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

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

Issue 10854054: Extensions Docs Server: Fix handling of nodocs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: return samples 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/handlebar_dict_generator.py
diff --git a/chrome/common/extensions/docs/server2/handlebar_dict_generator.py b/chrome/common/extensions/docs/server2/handlebar_dict_generator.py
index 08f0a2904c17a504ff32d76212771fb46bcdb1af..2a3b80abf431c6a0a2cd65064c3dd6e74b564f6c 100644
--- a/chrome/common/extensions/docs/server2/handlebar_dict_generator.py
+++ b/chrome/common/extensions/docs/server2/handlebar_dict_generator.py
@@ -3,7 +3,6 @@
# found in the LICENSE file.
import copy
-import logging
import os
from docs_server_utils import GetLinkToRefType
@@ -34,12 +33,10 @@ class HandlebarDictGenerator(object):
"""
def __init__(self, json):
clean_json = copy.deepcopy(json)
- _RemoveNoDocs(clean_json)
- try:
+ if _RemoveNoDocs(clean_json):
+ self._namespace = None
+ else:
self._namespace = model.Namespace(clean_json, clean_json['namespace'])
- except Exception as e:
- logging.error(e)
- raise
def _StripPrefix(self, name):
if name.startswith(self._namespace.name + '.'):
@@ -68,18 +65,16 @@ class HandlebarDictGenerator(object):
return ''.join(formatted_description)
def Generate(self, samples):
- try:
- return {
- 'name': self._namespace.name,
- 'types': map(self._GenerateType, self._namespace.types.values()),
- 'functions': self._GenerateFunctions(self._namespace.functions),
- 'events': map(self._GenerateEvent, self._namespace.events.values()),
- 'properties': self._GenerateProperties(self._namespace.properties),
- 'samples': samples,
- }
- except Exception as e:
- logging.error(e)
- raise
+ if self._namespace is None:
+ return { 'samples': samples }
+ return {
+ 'name': self._namespace.name,
+ 'types': map(self._GenerateType, self._namespace.types.values()),
+ 'functions': self._GenerateFunctions(self._namespace.functions),
+ 'events': map(self._GenerateEvent, self._namespace.events.values()),
+ 'properties': self._GenerateProperties(self._namespace.properties),
+ 'samples': samples,
+ }
def _GenerateType(self, type_):
type_dict = {
« no previous file with comments | « chrome/common/extensions/docs/server2/converter.py ('k') | chrome/common/extensions/docs/server2/integration_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698