Exemplo n.º 1
0
    def _get_resource(self, src_url, resources):
        if is_external(src_url):
            return src_url

        resources_dict = dict((resource.link_url, resource) for resource in resources)

        try:
            return resources_dict[src_url]
        except KeyError:
            raise Exception('Resource does not exist: {0}'.format(src_url))
Exemplo n.º 2
0
    def _get_resource(self, src_url, resources):

        if is_external(src_url):
            return src_url

        for split_char in ["#", "?"]:
            if split_char in src_url:
                src_url = src_url.split(split_char)[0]

        if src_url in resources:
            return resources[src_url].final_url

        return None
Exemplo n.º 3
0
    def _get_resource(self, src_url, resources):

        if is_external(src_url):
            return src_url

        for split_char in ["#", "?"]:
            if split_char in src_url:
                src_url = src_url.split(split_char)[0]

        if src_url in resources:
            return resources[src_url].final_url

        return None
Exemplo n.º 4
0
    def _get_resource(self, src_url, resources):

        if is_external(src_url):
            return src_url

        for split_char in ["#", "?"]:
            if split_char in src_url:
                src_url = src_url.split(split_char)[0]

        resources_dict = dict((resource.link_url, resource) for resource in resources)

        if src_url in resources_dict:
            return resources_dict[src_url].final_url

        return None
Exemplo n.º 5
0
    def _get_resource(self, src_url, resources):

        if is_external(src_url):
            return src_url

        for split_char in ["#", "?"]:
            if split_char in src_url:
                src_url = src_url.split(split_char)[0]

        resources_dict = dict(
            (resource.link_url, resource) for resource in resources)

        if src_url in resources_dict:
            return resources_dict[src_url].final_url

        return None