Issue #22 resolved

httpdomain: autoflask directive does not behave correctly with class-based views

jfinkels
created an issue

The autoflask directive does not behave correctly when endpoints are created as methods on a subclass of the MethodView class.

For example, if one creates endpoints like this in a module called somapp.py {{{ class SomeClass(MethodView): """Class-level documentation."""

def get(self, photoid):
    """GET method documentation."""
    ...

def post(self, photoid):
    """POST method documentation."""
    ...

app = Flask('someapp') app.add_url_rule('/someendpoint', view_func=SomeClass.as_view('somename')) }}} and documentation like this in a someapp.rst file (along with the other files necessary for Sphinx to run correctly) {{{ Some app ========

.. autoflask:: someapp:app }}} the documentation generated by Sphinx will show a listing for each of the methods (GET and POST), but the documentation beneath each method will be {{{ Class-level documentation. }}} instead of the corresponding method-level documentation.

Class-based views (such as the MethodView class) were new in Flask version 0.7 (see the API documentation at http://flask.pocoo.org/docs/api/#class-based-views ).