def render(self, session, feature, type, path, **kwargs):
        dbfeature = Feature.get_unique(session,
                                       name=feature,
                                       feature_type=type,
                                       compel=True)
        if not dbfeature.paramdef_holder:
            raise ArgumentError(
                "No parameter definitions found for {0:l}.".format(dbfeature))

        db_paramdef = ParamDefinition.get_unique(
            session, path=path, holder=dbfeature.paramdef_holder, compel=True)

        ## validate if this path is being used
        holder = search_path_in_personas(session, path,
                                         dbfeature.paramdef_holder)
        if holder:
            raise ArgumentError(
                "Parameter with path {0} used by following and cannot be deleted : "
                .format(path) + ", ".join([
                    "{0.holder_object:l}".format(h) for h in holder.iterkeys()
                ]))

        session.delete(db_paramdef)
        session.flush()

        return
Exemplo n.º 2
0
    def render(self, session, archetype, path, **arguments):

        db_paramdef = None

        if archetype:
            dbarchetype = Archetype.get_unique(session, archetype, compel=True)
            if not dbarchetype.paramdef_holder:
                return
            db_paramdef = ParamDefinition.get_unique(session, path=path,
                                                     holder=dbarchetype.paramdef_holder,
                                                     compel=True)
        if not db_paramdef:
            return

        holder = search_path_in_personas(session, path, db_paramdef.holder)
        return SimpleParameterList(holder.iteritems())
Exemplo n.º 3
0
    def render(self, session, archetype, path, **arguments):

        db_paramdef = None

        if archetype:
            dbarchetype = Archetype.get_unique(session, archetype, compel=True)
            if not dbarchetype.paramdef_holder:
                return
            db_paramdef = ParamDefinition.get_unique(
                session,
                path=path,
                holder=dbarchetype.paramdef_holder,
                compel=True)
        if not db_paramdef:
            return

        holder = search_path_in_personas(session, path, db_paramdef.holder)
        return SimpleParameterList(holder.iteritems())
    def render(self, session, archetype, path, **kwargs):
        dbarchetype = Archetype.get_unique(session, archetype, compel=True)
        if not dbarchetype.paramdef_holder:
            raise ArgumentError("No parameter definitions found for {0}."
                                .format(dbarchetype))

        db_paramdef = ParamDefinition.get_unique(session, path=path,
                                                 holder=dbarchetype.paramdef_holder,
                                                 compel=True)
        ## validate if this path is being used
        holder = search_path_in_personas(session, path, dbarchetype.paramdef_holder)
        if holder:
            raise ArgumentError("Parameter with path {0} used by following and cannot be deleted : ".format(path) +
                                ", ".join(["{0.holder_object:l}".format(h) for h in holder.iterkeys()]))

        session.delete(db_paramdef)
        session.flush()

        return