acoomans / flask-autodoc

Flask autodoc automatically creates an online documentation for your flask application.
MIT License
98 stars 49 forks source link

Allow a function to be decorated twice #19

Closed lukeyeager closed 9 years ago

lukeyeager commented 9 years ago

It's useful to be able to decorate all functions programmatically (see #1), but you might want to decorate specific functions as well. This allows new groups to be appended to the old list.

I also added a set_location flag to disable setting the location when decorating programmatically.

Usage:

@app.route('/home')
# add to groups "home" and "all"
# set location
@auto.doc(['home'])
def home():
    return "I'm home!"

for endpoint, function in app.view_functions.iteritems():
    # add to group "all-the-things"
    app.view_functions[endpoint] = auto.doc(['all-the-things'], set_location=False)(function)