Allows to access manager by model name - it is convenient, because HasOffers returns model names in responses.
182871
def setup_managers(self):
        
        self._managers = {}
        for manager_class in MODEL_MANAGERS:
            instance = manager_class(self)
            if not instance.forbid_registration \
                    and not isinstance(instance, ApplicationManager) or instance.__class__ is ApplicationManager:
                # Descendants of ``ApplicationManager`` shouldn't be present in API instance.  They are controlled by
                # Application controller. The manager itself, on the other hand, should.
                setattr(self, instance.name, instance)
            if instance.model:
                self._managers[instance.model.__name__] = instance
            if instance.model_aliases:
                for alias in instance.model_aliases:
                    self._managers[alias] = instance
1259103
def model_name
      if defined?(ActiveSupport::ModelName)
        ActiveSupport::ModelName.new(name)
      else
        ActiveModel::Name.new(self)
      end
    end
1071600
def get_model_name(model):
    
    opts = model._meta
    if django.VERSION[:2] < (1, 7):
        model_name = opts.module_name
    else:
        model_name = opts.model_name

    return model_name
175597
@RequestMapping(value = "/profiles", method = RequestMethod.GET)
    public String list(Model model) {
        Profile profiles = new Profile();
        model.addAttribute("addNewProfile", profiles);
        model.addAttribute("version", Constants.VERSION);
        logger.info("Loading initial page");

        return "profiles";
    }
1012051
def _models(self, appname):
        
        try:
            app = self._get_app(appname)
        except Exception as e:
            self.err("Can not get app " + appname, e)
            return
        if appname not in self.appnames:
            self.err("App " + appname + " not found in settings")
            return
        models = self._get_models(app)
        return models
57143
def model(name)
      model = created_model(name)
      return nil unless model
      Pickle::Adapter.get_model(model.class, model.id)
    end
83054
def _find_references(model_name, references=None):
    
    references = references or []
    references.append(model_name)

    ref = MODELS[model_name].get('reference')
    if ref is not None:
        _find_references(ref, references)

    parent_models = [m for m in references]
    parent_models.reverse()

    return parent_models
1110674
function (modelName) {
      if (["make", "list"].indexOf(modelName) === -1) {
        throw new Error(
          "checkOwnerApp middleware can only be configured with 'make' or 'list'. You passed in: '" +
          modelName +
          "'"
        );
      }

      return function (req, res, next) {
        // Don't enforce write permissions if not enabled.
        if (!ENFORCE_WRITE_PERMISSIONS) {
          return next();
        }

        var model = req[modelName],
          user = req.credentials.user;
        // check if the authenticated application has admin permissions, or if it owns the make
        if (req.credentials.admin !== true && user !== model.ownerApp) {
          return hawkModule.respond(403, res, req.credentials, req.artifacts, {
            status: "failure",
            reason: "unauthorized"
          }, "application/json");
        }
        next();
      };
    }
588561
def get_managers(self):
        
        if self._single_env:
            return None
        if not hasattr(self, '_managers'):
            self._managers = self.env.get_slave_managers()
        return self._managers
801820
function get(publicAPI, model = {}, names = []) {
  names.forEach((name) => {
    publicAPI[`get${capitalize(name)}`] = () => model[name];
  });
}
1300929
function(err, model) {
                    if (err) {
                        return _fn(err);
                    }
                    if (!model) {
                        return _fn('No model (' + name + ') returned from `adapter.registerModel`');
                    }
                    mycro.models[name] = model;
                    _fn();
                }
97661
def get_model(cls, version, model_name):
        
        models = cls.versions[version].model_options
        for keystore in models.values():
            if model_name in keystore:
                return keystore[model_name]
        raise ValueError("Unknown model name")
857736
function getModel(req, res, next, model) {
		var fullModel = Rhapsody.requireModel(model, true);

		if(!fullModel) {
			Rhapsody.log.verbose('Nonexistent model', 'Couldn\'t find collection %s.', model);
			return responseUtils.respond(res, 400); //Malformed syntax or a bad query
		}

		//This model does not allow REST API
		if(!fullModel.options.allowREST) {
			return responseUtils.respond(res, 404);
		}

		req.fullModel = fullModel;

		next();
	}
1078814
private ModelDef getOverrideModel(ModelDef model,
			ModelMetaData explicitMeta2) {
		if(explicitMeta2 == null){
			return model;
		}
		List<ModelDef> explicitList = explicitMeta2.getModelDefinitionList();
		for(ModelDef explicitModel : explicitList){
			if(explicitModel.getModelName().equals(model.getModelName())){
				return explicitModel;
			}
		}
		return model;
	}
791103
def model_ivar_get(plural = false)
      name = ivar_name(model_class)
      name = name.pluralize if plural
      name = :"@#{name}"
      instance_variable_get(name) if instance_variable_defined?(name)
    end
66106
def model_resource(self, resource_name):
        

        resource = first(
            [resource for resource in self.api._registry.values()
             if resource.get_api_name() == resource_name])

        data = {
            'apiVersion': '0.1',
            'swaggerVersion': '1.1',
            'basePath': '%s%s' % (self.base_uri(), self.api.url_prefix),
            'resourcePath': '/meta/%s' % resource.get_api_name(),
            'apis': self.get_model_apis(resource),
            'models': self.get_model(resource)
        }
        response = jsonify(data)
        response.headers.add('Cache-Control', 'max-age=0')
        return response
76936
def contribute_to_class(self, model, name):
        
        super(SearchableManager, self).contribute_to_class(model, name)
        setattr(model, name, ManagerDescriptor(self))