# Path: tmapi/exceptions.py
# class MalformedIRIException (TMAPIRuntimeException):
# 
#     """Thrown to indicate that a malformed IRI has occurred."""
# 
#     def __init__ (self, message):
#         """Constructs a `MalformedIRIException` with the specified
#         detail message."""
#         super(MalformedIRIException, self).__init__(message)


import unicodedata
import urllib
import urlparse
from tmapi.exceptions import MalformedIRIException
        """
        return self._reference

    def resolve (self, reference):
        """Resolves the `reference` against this locator.

        The returned `Locator` represents an absolute IRI.

        :param reference: the reference which should be resolved
          against this locator
        :type reference: string
        :rtype: `Locator`

        """
        return Locator(urlparse.urljoin(self._external, reference))
    
    def to_external_form (self):
        """Returns the external form of the IRI.

        Any special character will be escaped using the escaping
        conventions of RFC 3987.

        :rtype: String

        """
        return self._external

    def normalise (self, reference):
        parts = list(urlparse.urlsplit(reference))
        if not parts[0]:

# Path: tmapi/exceptions.py
# class MalformedIRIException (TMAPIRuntimeException):
# 
#     """Thrown to indicate that a malformed IRI has occurred."""
# 
#     def __init__ (self, message):
#         """Constructs a `MalformedIRIException` with the specified
#         detail message."""
#         super(MalformedIRIException, self).__init__(message)


# Path: tmapi/models/locator.py
import unicodedata
import urllib
import urlparse
from tmapi.exceptions import MalformedIRIException

        """
        return self._reference

    def resolve (self, reference):
        """Resolves the `reference` against this locator.

        The returned `Locator` represents an absolute IRI.

        :param reference: the reference which should be resolved
          against this locator
        :type reference: string
        :rtype: `Locator`

        """
        return Locator(urlparse.urljoin(self._external, reference))
    
    def to_external_form (self):
        """Returns the external form of the IRI.

        Any special character will be escaped using the escaping
        conventions of RFC 3987.

        :rtype: String

        """
        return self._external

    def normalise (self, reference):
        parts = list(urlparse.urlsplit(reference))
        if not parts[0]:

            raise MalformedIRIException('IRI has no protocol')