示例#1
0
 def should_add_element_namespace(element_holder):
     # Preventing of adding namespace prefix to cloudify
     # basic types.
     overridable_cloudify_type =\
         utils.check_if_overridable_cloudify_type(element_holder.value)
     return (not overridable_cloudify_type
             and not hasattr(element_holder, SKIP_NAMESPACE_FLAG))
示例#2
0
 def cloudify_type(element_key_holder, element_value_holder):
     """
     If the element (key+value) is marked with Cloudify basic type flag
     or the user overridden one.
     """
     return (element_value_holder.is_cloudify_type
             or utils.check_if_overridable_cloudify_type(
                 element_key_holder.value))
示例#3
0
def _prepare_namespaced_elements(key_holder, namespace, value_holder):
    if isinstance(value_holder.value, dict):
        _mark_key_value_holder_items(value_holder, 'namespace', namespace)
    elif isinstance(value_holder.value, text_type):
        # In case of primitive type we a need a different way to mark
        # the sub elements with the namespace, but leaving the option
        # for the DSL element to not receive the namespace.
        value_holder.only_children_namespace = True

        value_holder.namespace = namespace
    if not utils.check_if_overridable_cloudify_type(key_holder.value):
        key_holder.value = utils.generate_namespaced_value(
            namespace, key_holder.value)
示例#4
0
 def should_add_namespace_to_string_leaf(element):
     if not isinstance(element._initial_value, text_type):
         return False
     is_premitive_type = (element._initial_value
                          in constants.USER_PRIMITIVE_TYPES)
     overridable_cloudify_type = \
         utils.check_if_overridable_cloudify_type(
             element._initial_value)
     should_skip_adding_namespace =\
         hasattr(element.initial_value_holder, SKIP_NAMESPACE_FLAG)
     return (not is_premitive_type and not overridable_cloudify_type
             and not should_skip_adding_namespace
             and element.add_namespace_to_schema_elements)