changeset 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
files makeitso/template.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/makeitso/template.py	Fri Jan 07 16:53:55 2011 -0800
+++ b/makeitso/template.py	Fri Jan 07 18:09:43 2011 -0800
@@ -50,6 +50,18 @@
         else:
             return 'Enter %s:' % description
 
+def assemble(*args):
+    names = set()
+    retval = []
+    for arg in args:
+        if isinstance(arg, MakeItSoTemplate):
+            arg = arg.vars
+        for variable in args:
+            if variable.name in names:
+                continue
+            retval.append(variable.copy())
+    return retval
+
 class MakeItSoTemplate(ContentTemplate):
     """API template for MakeItSo"""