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

Side by Side Diff: grit/gather/interface.py

Issue 16539002: GRIT: Enable variable expansion in filenames during HTML inlining. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: Created 7 years, 6 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 unified diff | Download patch
« no previous file with comments | « grit/gather/chrome_html_unittest.py ('k') | grit/node/structure.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 '''Interface for all gatherers. 6 '''Interface for all gatherers.
7 ''' 7 '''
8 8
9 9
10 import os.path 10 import os.path
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 raise NotImplementedError() 145 raise NotImplementedError()
146 146
147 def SubstituteMessages(self, substituter): 147 def SubstituteMessages(self, substituter):
148 '''Applies substitutions to all messages in the gatherer. 148 '''Applies substitutions to all messages in the gatherer.
149 149
150 Args: 150 Args:
151 substituter: a grit.util.Substituter object. 151 substituter: a grit.util.Substituter object.
152 ''' 152 '''
153 pass 153 pass
154 154
155 def SetFilenameExpansionFunction(self, fn):
156 '''Sets a function for rewriting filenames before gathering.'''
157 pass
158
155 # TODO(benrg): Move this elsewhere, since it isn't part of the interface. 159 # TODO(benrg): Move this elsewhere, since it isn't part of the interface.
156 def _LoadInputFile(self): 160 def _LoadInputFile(self):
157 '''A convenience function for subclasses that loads the contents of the 161 '''A convenience function for subclasses that loads the contents of the
158 input file. 162 input file.
159 ''' 163 '''
160 if isinstance(self.rc_file, types.StringTypes): 164 if isinstance(self.rc_file, types.StringTypes):
161 path = self.GetInputPath() 165 path = self.GetInputPath()
162 # Hack: some unit tests supply an absolute path and no root node. 166 # Hack: some unit tests supply an absolute path and no root node.
163 if not os.path.isabs(path): 167 if not os.path.isabs(path):
164 path = self.grd_node.ToRealPath(path) 168 path = self.grd_node.ToRealPath(path)
165 return util.ReadFile(path, self.encoding) 169 return util.ReadFile(path, self.encoding)
166 else: 170 else:
167 return self.rc_file.read() 171 return self.rc_file.read()
OLDNEW
« no previous file with comments | « grit/gather/chrome_html_unittest.py ('k') | grit/node/structure.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698