def render(self, session, feature, type, path, value_type, required, rebuild_required, default, description, **kwargs): dbfeature = Feature.get_unique(session, name=feature, feature_type=type, compel=True) if not dbfeature.paramdef_holder: dbfeature.paramdef_holder = FeatureParamDef() ## strip slash from path start and end if path.startswith("/"): path = path[1:] if path.endswith("/"): path = path[:-1] validate_param_definition(path, value_type, default) ParamDefinition.get_unique(session, path=path, holder=dbfeature.paramdef_holder, preclude=True) db_paramdef = ParamDefinition(path=path, holder=dbfeature.paramdef_holder, value_type=value_type, default=default, required=required, rebuild_required=rebuild_required, description=description) session.add(db_paramdef) session.flush() return
def render(self, session, archetype, template, path, value_type, required, rebuild_required, default, description, **kwargs): dbarchetype = Archetype.get_unique(session, archetype, compel=True) if not dbarchetype.is_compileable: raise ArgumentError("{0} is not compileable.".format(dbarchetype)) if not dbarchetype.paramdef_holder: dbarchetype.paramdef_holder = ArchetypeParamDef() ## strip slash from path start and end if path.startswith("/"): path = path[1:] if path.endswith("/"): path = path[:-1] validate_param_definition(path, value_type, default) ParamDefinition.get_unique(session, path=path, holder=dbarchetype.paramdef_holder, preclude=True) db_paramdef = ParamDefinition(path=path, holder=dbarchetype.paramdef_holder, value_type=value_type, default=default, required=required, template=template, rebuild_required=rebuild_required, description=description) session.add(db_paramdef) session.flush() return