def obj_load_attr(self, attrname): if attrname != 'rules': raise exceptions.ObjectActionError( action='obj_load_attr', reason='unable to load %s' % attrname) if not hasattr(self, attrname): self.reload_rules()
def update_synthetic_fields(mcs, bases, dct): if not dct.get('synthetic_fields', None): synthetic_attr = mcs.get_attribute('synthetic_fields', bases, dct) dct['synthetic_fields'] = synthetic_attr or [] if 'shared' in dct['synthetic_fields']: raise n_exc.ObjectActionError( action=_('shared attribute switching to synthetic'), reason=_('already a synthetic attribute')) dct['synthetic_fields'].append('shared')
def obj_load_attr(self, attrname): if attrname == 'project_id': return super(QosPolicy, self).obj_load_attr(attrname) if attrname != 'rules': raise exceptions.ObjectActionError(action='obj_load_attr', reason=_('unable to load %s') % attrname) if not hasattr(self, attrname): self.reload_rules()