+
Skip to content

Empty resource.contents after autoload #112

Open
@AnNeub

Description

@AnNeub

This issue occur if a autoloaded resource is accessed via get_resource again. The problem occur in the function _update_container where the value is removed from contents. If accessing the same resource again, the resource is already loaded but has no contents.

I resolve this issue by adding the following lines to get_resource

        if uri.normalize() in self.resources:
            resource = self.resources[uri.normalize()]
            if resource.contents:
                return self.resources[uri.normalize()]
        else:
            # If not, we create a new resource
            resource = self.create_resource(uri)

See the stack trace below, when that happens. The line numbers may be not 100% correct.

_try_resource_autoload, resource.py:464
_get_href_decoder, resource.py:453
resolve_object, resource.py:400
__getattribute__, ecore.py:1018
_update_container, valuecontainer.py:78
add, valuecontainer.py:346

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载