Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traversing RESTWrapper with VirtualHostMonster raises KeyError #99

Open
oggers opened this issue Nov 3, 2019 · 1 comment · May be fixed by #105
Open

Traversing RESTWrapper with VirtualHostMonster raises KeyError #99

oggers opened this issue Nov 3, 2019 · 1 comment · May be fixed by #105

Comments

@oggers
Copy link

oggers commented Nov 3, 2019

If you traverse /VirtualHostBase/http/localhost:8080/plone/folder1/VirtualHostRoot/folder2 it raises a KeyError in RESTWrapper.publishTraverse.
There should be consider a VirtualHostMonster the same as in RESTTraverse.publishTraverse.

I changed RESTWrapper.publishTraverse so that it works:

   def publishTraverse(self, request, name):                                                                                          
        # Try to get an object using default traversal                                                                                 
        adapter = DefaultPublishTraverse(self.context, request)                                                                        
        try:                                                                                                                           
            obj = adapter.publishTraverse(request, name)                                                                               
            if not IContentish.providedBy(obj) and not IService.providedBy(obj):                                                       
                if isinstance(obj, VirtualHostMonster):                                                                                
                    return obj                                                                                                         
                else:                                                                                                                  
                    raise KeyError
@petri
Copy link
Member

petri commented Nov 2, 2020

@oggers could you try the https://github.com/plone/plone.rest/tree/simplify-traversal branch and let us know if it resolves this issue as well?

@petri petri linked a pull request Oct 5, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants