Changeset 2652
- Timestamp:
- Jun 10, 2010 11:17:35 AM (11 years ago)
- Location:
- coopr.pyomo/trunk/coopr/pyomo/base
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
coopr.pyomo/trunk/coopr/pyomo/base/component.py
r2592 r2652 10 10 implements(IModelComponent) 11 11 12 def __init__(self, ctype): 12 def __init__(self, ctype=None): 13 14 # Error check for ctype 15 if ctype is None: 16 raise DeveloperError, "Must specify a class for the component type!" 17 13 18 self.active=True 14 19 self._type=ctype … … 28 33 pass 29 34 35 class DeveloperError(Exception): 36 """ 37 Exception class used to throw errors stemming from Pyomo programming 38 errors, rather than user modeling errors (e.g., a component not declaring 39 a 'ctype') 40 """ 41 42 def __init__(self, val): 43 self.parameter = val 44 45 def __str__(self): 46 return repr(self.parameter) -
coopr.pyomo/trunk/coopr/pyomo/base/indexed_component.py
r2359 r2652 7 7 8 8 def __init__(self, *args, **kwds): 9 if 'ctype' not in kwds: 10 raise ValueError, "Must specify a class for the component type!" 11 Component.__init__(self, kwds['ctype']) 9 10 # Don't be afraid to pass None, correct 'ctype' can be passed via 11 # other routes. Error handling now in Component 12 component_type = kwds.get('ctype', None) 13 Component.__init__(self, component_type) 14 12 15 self._ndim=0 13 16 self._index_set=None
Note: See TracChangeset
for help on using the changeset viewer.