Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / docs / server2 / api_models.py
index d7cacc4..bf457f4 100644 (file)
@@ -7,7 +7,7 @@ import posixpath
 from compiled_file_system import SingleFile, Unicode
 from extensions_paths import API_PATHS
 from file_system import FileNotFoundError
-from future import Future
+from future import Collect, Future
 from schema_util import ProcessSchema
 from third_party.json_schema_compiler.model import Namespace, UnixName
 
@@ -16,7 +16,8 @@ from third_party.json_schema_compiler.model import Namespace, UnixName
 @Unicode
 def _CreateAPIModel(path, data):
   schema = ProcessSchema(path, data)[0]
-  if not schema: return None
+  if not schema:
+    raise FileNotFoundError('No schema for %s' % path)
   return Namespace(schema, schema['namespace'])
 
 
@@ -83,6 +84,10 @@ class APIModels(object):
       futures[0].Get()
     return Future(callback=resolve)
 
+  def Cron(self):
+    futures = [self.GetModel(name) for name in self.GetNames()]
+    return Collect(futures, except_pass=FileNotFoundError)
+
   def IterModels(self):
     future_models = [(name, self.GetModel(name)) for name in self.GetNames()]
     for name, future_model in future_models: