jacek99 / corepost

REST micro-framework for Python Twisted with multi-core support
http://jacek99.github.com/corepost/
Other
47 stars 15 forks source link

Inheritance of service urls #11

Open llonchj opened 11 years ago

llonchj commented 11 years ago

I am trying corepost. Looks great!

With the following code running, a call to http://0.0.0.0:8000/test results to status=404, body=URL '/test' not found. It should be: status = 200, body = /test ?

from corepost.web import route, RESTResource
from corepost.enums import Http

class OneService():
    @route("/test")
    def test(self,request,**kwargs):
        return request.path

class OtherRESTService(OneService):
    @route("/test2")
    def root(self,request,**kwargs):
        return request.path

if __name__ == '__main__':
    app = RESTResource(services=(OtherRESTService(),))
    app.run(8000)
jacek99 commented 11 years ago

not sure I get the point :-/

you would create duplicate URL handlers all over the place, no?

Could you give me a valid example of why this would be useful?

llonchj commented 11 years ago

A plugin that extends a service with new endpoints. This is the main trigger for this issue found integrating corepost into Scrapyd (www.scrapy.org).