Mercurial > hg > MakeItSo
comparison makeitso/template.py @ 71:95d1bb85ab3c
add a copy method to a variable to get a non-futzed copy
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Fri, 07 Jan 2011 16:53:55 -0800 |
| parents | cb00c011ff45 |
| children | f44af8f30147 |
comparison
equal
deleted
inserted
replaced
| 70:cb00c011ff45 | 71:95d1bb85ab3c |
|---|---|
| 24 | 24 |
| 25 # TODO (maybe): get cast from default variable type if not None | 25 # TODO (maybe): get cast from default variable type if not None |
| 26 self.cast = cast | 26 self.cast = cast |
| 27 | 27 |
| 28 self._set = False | 28 self._set = False |
| 29 | |
| 30 def copy(self): | |
| 31 """returns a copy of the variable""" | |
| 32 return Variable(self.name, self.description, self.default, self.cast) | |
| 29 | 33 |
| 30 def set(self, value): | 34 def set(self, value): |
| 31 if self.cast: | 35 if self.cast: |
| 32 self.value = self.cast(value) | 36 self.value = self.cast(value) |
| 33 else: | 37 else: |
