예제 #1
0
 def parse_db_type(self):
     if self.db_type:
         (self._identifier, self._type, self._namespace) = \
             parse_port_spec_item_string(self.db_type,
                                         get_vistrails_basic_pkg_id())
     else:
         self._identifier = None
         self._type = None
         self._namespace = None
예제 #2
0
 def parse_db_type(self):
     if self.db_type:
         (self._identifier, self._type, self._namespace) = \
             parse_port_spec_item_string(self.db_type,
                                         get_vistrails_basic_pkg_id())
     else:
         self._identifier = None
         self._type = None
         self._namespace = None
    def __init__(self, *args, **kwargs):
        if "sigstring" in kwargs:
            sigstring = kwargs["sigstring"]
            del kwargs["sigstring"]

            (package, module, namespace) = \
                parse_port_spec_item_string(sigstring)
            if "package" not in kwargs:
                kwargs["package"] = package
            if "module" not in kwargs:
                kwargs["module"] = module
            if "namespace" not in kwargs:
                kwargs["namespace"] = namespace
        if "values" in kwargs:
            if (kwargs["values"] is not None and
                    not isinstance(kwargs["values"], basestring)):
                kwargs["values"] = str(kwargs["values"])
        if 'id' not in kwargs:
            kwargs['id'] = -1

        def update_identifier(identifier):
            """check for changed identifiers (e.g. edu.utah.sci.vistrails ->
            org.vistrails.vistrails) and use the current one.

            """
            from vistrails.core.modules.module_registry import \
                get_module_registry, MissingPackage
            reg = get_module_registry()
            try:
                identifier = reg.get_package_by_name(identifier).identifier
            except MissingPackage:
                # catch this later, just trying to ensure that old
                # identifiers are updated
                pass
            return identifier
            
        # args[3] is the package argument
        # FIXME this is schema-dependent...
        if len(args) > 3:
            args[3] = update_identifier(args[3])
        if "package" in kwargs:
            kwargs["package"] = update_identifier(kwargs["package"])
        DBPortSpecItem.__init__(self, *args, **kwargs)
        self.set_defaults()
예제 #4
0
    def __init__(self, *args, **kwargs):
        if "sigstring" in kwargs:
            sigstring = kwargs["sigstring"]
            del kwargs["sigstring"]

            (package, module, namespace) = \
                parse_port_spec_item_string(sigstring)
            if "package" not in kwargs:
                kwargs["package"] = package
            if "module" not in kwargs:
                kwargs["module"] = module
            if "namespace" not in kwargs:
                kwargs["namespace"] = namespace
        if "values" in kwargs:
            if (kwargs["values"] is not None
                    and not isinstance(kwargs["values"], basestring)):
                kwargs["values"] = str(kwargs["values"])
        if 'id' not in kwargs:
            kwargs['id'] = -1

        def update_identifier(identifier):
            """check for changed identifiers (e.g. edu.utah.sci.vistrails ->
            org.vistrails.vistrails) and use the current one.

            """
            reg = get_module_registry()
            MissingPackage = get_MissingPackage()
            try:
                identifier = reg.get_package_by_name(identifier).identifier
            except MissingPackage:
                # catch this later, just trying to ensure that old
                # identifiers are updated
                pass
            return identifier

        # args[3] is the package argument
        # FIXME this is schema-dependent...
        if len(args) > 3:
            args[3] = update_identifier(args[3])
        if "package" in kwargs:
            kwargs["package"] = update_identifier(kwargs["package"])
        DBPortSpecItem.__init__(self, *args, **kwargs)
        self.set_defaults()