Index: client/dom/scripts/dartgenerator.py |
diff --git a/client/dom/scripts/dartgenerator.py b/client/dom/scripts/dartgenerator.py |
index 6966f6b34771af4cee02d6d36482535bfcf33551..7e3d246ec89ce8dcb2be9c44ec308bb2091b3c2b 100755 |
--- a/client/dom/scripts/dartgenerator.py |
+++ b/client/dom/scripts/dartgenerator.py |
@@ -19,6 +19,7 @@ from systemhtml import * |
from systeminterface import * |
from systemnative import * |
from systemwrapping import * |
+from templateloader import TemplateLoader |
_logger = logging.getLogger('dartgenerator') |
@@ -282,7 +283,8 @@ class DartGenerator(object): |
if 'htmlfrog' in systems: |
html_system = HtmlFrogSystem( |
TemplateLoader(self._template_dir, |
- ['html/frog', 'html/impl', 'html', '']), |
+ ['html/frog', 'html/impl', 'html', ''], |
+ {'DARTIUM': False, 'FROG': True}), |
self._database, self._emitters, self._output_dir, self) |
html_system._interface_system = html_interface_system |
@@ -291,7 +293,8 @@ class DartGenerator(object): |
if 'htmldartium' in systems: |
html_system = HtmlDartiumSystem( |
TemplateLoader(self._template_dir, |
- ['html/dartium', 'html/impl', 'html', '']), |
+ ['html/dartium', 'html/impl', 'html', ''], |
+ {'DARTIUM': True, 'FROG': False}), |
self._database, self._emitters, self._output_dir, self) |
html_system._interface_system = html_interface_system |
@@ -543,44 +546,6 @@ def _PairUpAttributes(attributes): |
# ------------------------------------------------------------------------------ |
-class TemplateLoader(object): |
- """Loads template files from a path.""" |
- |
- def __init__(self, root, subpaths): |
- """Initializes loader. |
- |
- Args: |
- root - a string, the directory under which the templates are stored. |
- subpaths - a list of strings, subpaths of root in search order. |
- """ |
- self._root = root |
- self._subpaths = subpaths |
- self._cache = {} |
- |
- def TryLoad(self, name): |
- """Returns content of template file as a string, or None of not found.""" |
- if name in self._cache: |
- return self._cache[name] |
- |
- for subpath in self._subpaths: |
- template_file = os.path.join(self._root, subpath, name) |
- if os.path.exists(template_file): |
- template = ''.join(open(template_file).readlines()) |
- self._cache[name] = template |
- return template |
- |
- return None |
- |
- def Load(self, name): |
- """Returns contents of template file as a string, or raises an exception.""" |
- template = self.TryLoad(name) |
- if template is not None: # Can be empty string |
- return template |
- raise Exception("Could not find template '%s' on %s / %s" % ( |
- name, self._root, self._subpaths)) |
- |
-# ------------------------------------------------------------------------------ |
- |
class DummyImplementationSystem(System): |
"""Generates a dummy implementation for use by the editor analysis. |