I have a plugin that changes deploy path of some resources. I discovered that in
this case hyde server will not serve files properly, it will generate exception.
> Exception happened during processing of request from ('127.0.0.1', 51501)
> Traceback (most recent call last):
> File "/usr/lib64/python2.7/SocketServer.py", line 284, in _handle_request_noblock
> self.process_request(request, client_address)
> File "/usr/lib64/python2.7/SocketServer.py", line 310, in process_request
> self.finish_request(request, client_address)
> File "/usr/lib64/python2.7/SocketServer.py", line 323, in finish_request
> self.RequestHandlerClass(request, client_address, self)
> File "/usr/lib64/python2.7/SocketServer.py", line 639, in __init__
> self.handle()
> File "/usr/lib64/python2.7/BaseHTTPServer.py", line 343, in handle
> self.handle_one_request()
> File "/usr/lib64/python2.7/BaseHTTPServer.py", line 331, in handle_one_request
> method()
> File "/home/gry/hyde/hyde/server.py", line 51, in do_GET
> SimpleHTTPRequestHandler.do_GET(self)
> File "/usr/lib64/python2.7/SimpleHTTPServer.py", line 44, in do_GET
> f = self.send_head()
> File "/usr/lib64/python2.7/SimpleHTTPServer.py", line 66, in send_head
> path = self.translate_path(self.path)
> File "/home/gry/hyde/hyde/server.py", line 72, in translate_path
> res = node.get_resource('index.html')
> AttributeError: 'NoneType' object has no attribute 'get_resource'
This happens because hyde server first gets a node with:
> node = site.content.node_from_relative_path(path)
and then gets resource from it with:
> res = node.get_resource('index.html')
However if path for resource was changed then its directory under deploy dir may
not have corresponding directory under content and node may become None.
So this basically should be replaced with something like:
> res = site.content.resource_from_relative_deploy_path(path.rstrip('/') + os.sep + 'index.html')
This should get original resource even in described case.
But as turned out when hyde serve is launched it will not call plugins, so
RootNode will have empty resource_deploy_map and calling
resource_from_relative_deploy_path function in serve mode returns None.
Can anyone explain if this can be fixed?
--
Grygoriy Fuchedzhy
How the server looks up dynamic resources leaves a lot to be desired. I will add an issue and fix it as part of 0.8.5.
Thanks
Lakshmi
> --
> You received this message because you are subscribed to the Google Groups "Hyde" group.
> To post to this group, send email to hyde...@googlegroups.com.
> To unsubscribe from this group, send email to hyde-dev+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/hyde-dev?hl=en.
>