Permalink
Browse files

Enforce twc.Required (for #25).

  • Loading branch information...
ralphbean committed May 26, 2013
1 parent ca81db0 commit 94e61ec529a6ca04581435c1d579e05f5bf8b058
Showing with 5 additions and 0 deletions.
  1. +5 −0 tw2/core/widgets.py
@@ -324,6 +324,11 @@ def prepare(self):
if not hasattr(self, 'id'):
self.id = 'id_' + str(uuid.uuid4()).replace('-', '')
# Then, enforce any params marked with twc.Required.
for k, v in self._params.items():
if v.default is pm.Required and not hasattr(self, k):
raise ValueError("%r is a required Parameter" % k)
for a in self._deferred:
dfr = getattr(self, a)
if isinstance(dfr, pm.Deferred):

0 comments on commit 94e61ec

Please sign in to comment.