def tmpl_tags(self): "Scan template files and return template tags" keys = [] sdir = '%s/%s' % (self.tdir, self.tmpl) for name in os.listdir(sdir): if name[-1] == '~': continue if name == 'CVS': continue fname = os.path.join(sdir, name) with open(fname, 'r') as stream: for line in stream.readlines(): if line.find('__') != -1: # possible key keys += [k for k in parse_word(line)] return set(keys)