lazr-users team mailing list archive
-
lazr-users team
-
Mailing list archive
-
Message #00026
Re: Using lazr.restful with a zope3 app
Ok, my first email was vague (late work day, I guess I was too tired)
Now I also understand a bit more the martian stuff which I did not had much
idea first and things make some more sense
So, I removed the root["foobar"] hack and tried a few things in zope debug
prompt:
>>> request = create_web_service_request("/api/1.0/")
>>> request.traverse(root)
<tp4.rest.root.WebServiceRootResource object at 0xeca8fec>
>>> request = create_web_service_request("/api/1.0/systems") # systems is a
collection I created
>>> request.traverse(root)
<lazr.restful._resource.CollectionResource object at 0xbca4c8c>
So, at least the setup seems right, or part of it
The create_web_service_request, as well as the WSGIApplication, are
customizing the request to empower it so it can find and deal with the WS.
How can I do that when a request is really coming from a browser?
2010/6/17 Gustavo Rahal <gustavorahal@xxxxxxxxx>
> Hello
>
> I'm trying to setup lazr.restful with a zope3 app, more specifically
> z3ext/zojax (http://z3ext.net and <http://z3ext.net/>
> http://sourceforge.net/projects/zojax/<https://sourceforge.net/projects/zojax/>
> )
> Part of my trouble is just plain lack of traversal/publisher/zope3
> knowledge but I did understand some bits from reading the txt files in
> lazr.resful package.
>
> So, I noticed that the WSGI app class (wsgi.WSGIApplication) has the
> "__iter__" method that seems to be customizing the request and publisher
> that takes care of the request. Also, by reading Martjin email (
> https://lists.launchpad.net/lazr-users/msg00006.html) it seems that I need
> to plug in this customization into my zope app. Is this something I need to
> do manually or lazr.restful does it for me when I register a RootResource ?.
> If I need to do that, how should I proceed?
>
> I tried a lame test and simply added my service root object into app root
> when I accessed localhost:8080/foobar I could get the service root
>
> service = getUtility(IServiceRootResource)
> root["foobar"] = service
> transaction.commit()
>
> apparently it did not work. I'm not sure how I can test that
> programatically as well. Doing a getMultiAdapter((root["foobar"], request),
> name=??) does not seem to make much sense as I don't have a view name...
>
> Anyway, i'm clearly lost in the zope3/lazr concepts so some direction is
> appreciated
>
>
> Thanks
> Gustavo
>
>
>
Follow ups
References