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

Side by Side Diff: tools/grit/grit/node/include.py

Issue 28222: Fix a bug where the flattened HTML file was not getting (Closed)
Patch Set: Created 11 years, 9 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 | « no previous file | no next file » | 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/python2.4 1 #!/usr/bin/python2.4
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2008 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 '''Handling of the <include> element. 6 '''Handling of the <include> element.
7 ''' 7 '''
8 8
9 import os 9 import os
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return self.FilenameToOpen() 50 return self.FilenameToOpen()
51 51
52 def GetDataPackPair(self, output_dir, lang): 52 def GetDataPackPair(self, output_dir, lang):
53 '''Returns a (id, string) pair that represents the resource id and raw 53 '''Returns a (id, string) pair that represents the resource id and raw
54 bytes of the data. This is used to generate the data pack data file. 54 bytes of the data. This is used to generate the data pack data file.
55 ''' 55 '''
56 from grit.format import rc_header 56 from grit.format import rc_header
57 id_map = rc_header.Item.tids_ 57 id_map = rc_header.Item.tids_
58 id = id_map[self.GetTextualIds()[0]] 58 id = id_map[self.GetTextualIds()[0]]
59 filename = self.FilenameToOpen() 59 filename = self.FilenameToOpen()
60 if not os.path.exists(filename): 60 if self.attrs['flattenhtml'] == 'true':
61 # Try to open the file relative to the output dir if it's not relative to 61 # If the file was flattened, the flattened file is in the output dir.
62 # the grd file. 62 filename = os.path.join(output_dir, os.path.split(filename)[1])
63 filename = os.path.join(output_dir, self.attrs['file'])
64 63
65 file = open(filename, 'rb') 64 file = open(filename, 'rb')
66 data = file.read() 65 data = file.read()
67 file.close() 66 file.close()
68 67
69 return id, data 68 return id, data
70 69
71 # static method 70 # static method
72 def Construct(parent, name, type, file, translateable=True, 71 def Construct(parent, name, type, file, translateable=True,
73 filenameonly=False, relativepath=False): 72 filenameonly=False, relativepath=False):
(...skipping 10 matching lines...) Expand all
84 node.HandleAttribute('name', name) 83 node.HandleAttribute('name', name)
85 node.HandleAttribute('type', type) 84 node.HandleAttribute('type', type)
86 node.HandleAttribute('file', file) 85 node.HandleAttribute('file', file)
87 node.HandleAttribute('translateable', translateable) 86 node.HandleAttribute('translateable', translateable)
88 node.HandleAttribute('filenameonly', filenameonly) 87 node.HandleAttribute('filenameonly', filenameonly)
89 node.HandleAttribute('relativepath', relativepath) 88 node.HandleAttribute('relativepath', relativepath)
90 node.EndParsing() 89 node.EndParsing()
91 return node 90 return node
92 Construct = staticmethod(Construct) 91 Construct = staticmethod(Construct)
93 92
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698