comparison makeitso/template.py @ 72:f44af8f30147

add function to assemble variables
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 07 Jan 2011 18:09:43 -0800
parents 95d1bb85ab3c
children 3db48fdc6be3
comparison
equal deleted inserted replaced
71:95d1bb85ab3c 72:f44af8f30147
47 description = self.description or self.name 47 description = self.description or self.name
48 if self.default: 48 if self.default:
49 return 'Enter %s [DEFAULT: %s]:' % (description, repr(self.default)) 49 return 'Enter %s [DEFAULT: %s]:' % (description, repr(self.default))
50 else: 50 else:
51 return 'Enter %s:' % description 51 return 'Enter %s:' % description
52
53 def assemble(*args):
54 names = set()
55 retval = []
56 for arg in args:
57 if isinstance(arg, MakeItSoTemplate):
58 arg = arg.vars
59 for variable in args:
60 if variable.name in names:
61 continue
62 retval.append(variable.copy())
63 return retval
52 64
53 class MakeItSoTemplate(ContentTemplate): 65 class MakeItSoTemplate(ContentTemplate):
54 """API template for MakeItSo""" 66 """API template for MakeItSo"""
55 67
56 # name of the template 68 # name of the template