def new(__context, __type_name, __owner=None, __object_name=None, __extra=None, **parameters):
    object_store = helpers.get_object_store(__context)
    new_context = __context.create_child_context()
    for key, value in parameters.iteritems():
        if helpers.is_keyword(key):
            new_context[key] = value
    return __type_name.murano_class.new(__owner, object_store, name=__object_name)(new_context, **parameters)
Esempio n. 2
0
def new(__context,
        __type_name,
        __owner=None,
        __object_name=None,
        __extra=None,
        **parameters):
    object_store = helpers.get_object_store(__context)
    new_context = __context.create_child_context()
    for key, value in parameters.iteritems():
        if helpers.is_keyword(key):
            new_context[key] = value
    return __type_name.murano_class.new(__owner,
                                        object_store,
                                        name=__object_name)(new_context,
                                                            **parameters)
Esempio n. 3
0
def filter_parameters(__fd, *args, **kwargs):
    if "*" not in __fd.parameters:
        position_args = 0
        for p in six.itervalues(__fd.parameters):
            if p.position is not None:
                position_args += 1
        args = args[:position_args]
    kwargs = kwargs.copy()
    for name in kwargs.keys():
        if not helpers.is_keyword(name):
            del kwargs[name]
    if "**" not in __fd.parameters:
        names = {p.alias or p.name for p in six.itervalues(__fd.parameters)}
        for name in kwargs.keys():
            if name not in names:
                del kwargs[name]
    return args, kwargs
Esempio n. 4
0
def filter_parameters(__fd, *args, **kwargs):
    if '*' not in __fd.parameters:
        position_args = 0
        for p in __fd.parameters.itervalues():
            if p.position is not None:
                position_args += 1
        args = args[:position_args]
    kwargs = kwargs.copy()
    for name in kwargs.keys():
        if not helpers.is_keyword(name):
            del kwargs[name]
    if '**' not in __fd.parameters:
        names = {p.alias or p.name for p in __fd.parameters.itervalues()}
        for name in kwargs.keys():
            if name not in names:
                del kwargs[name]
    return args, kwargs