comparison licenser/licenses.py @ 2:b8d620fa1116

solidify refactored workflow"
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 10 May 2010 11:46:49 -0700
parents cc5add25bf83
children e700bd2ec289
comparison
equal deleted inserted replaced
1:cc5add25bf83 2:b8d620fa1116
1 import os 1 import os
2
3 from datetime import datetime 2 from datetime import datetime
4 3
5 class License(object): 4 class License(object):
6 """Abstract base class for a license""" 5 """Abstract base class for a license"""
7 6
13 'licenses', 12 'licenses',
14 self.template) 13 self.template)
15 assert os.path.exists(self.template) 14 assert os.path.exists(self.template)
16 15
17 def __call__(self, directory, **kw): 16 def __call__(self, directory, **kw):
17 variables = self.obtain_variables(**kw)
18 self.interpolate(directory, variables)
19
20 def obtain_variables(self, **kw):
18 for var in self.variables: 21 for var in self.variables:
19 if var not in kw: 22 if var not in kw:
20 print 'Enter %s: ' % var, 23 print 'Enter %s: ' % var,
21 kw[var] = raw_input() 24 kw[var] = raw_input()
22 self.pre(kw) 25 self.pre(kw)
23 self.interpolate(directory, kw) 26 return kw
24 27
25 def pre(self, variables): 28 def pre(self, variables):
26 """do anything that needs to be done before interpolation""" 29 """do anything that needs to be done before interpolation"""
27 30
28 def interpolate(self, directory, variables): 31 def interpolate(self, directory, variables):