Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update @jsonapi to use functools.wraps #187

Merged
merged 1 commit into from
Dec 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions infogami/plugins/api/code.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
"""
Infogami read/write API.
"""
import json
from functools import wraps

import web
import infogami
from infogami.utils import delegate, features
from infogami.utils.view import safeint
from infogami.infobase import client
import json

hooks = {}

Expand Down Expand Up @@ -139,6 +141,7 @@ def POST(self):


def jsonapi(f):
@wraps(f)
def g(*a, **kw):
try:
out = f(*a, **kw)
Expand All @@ -157,7 +160,6 @@ def g(*a, **kw):

return delegate.RawText(out, content_type=content_type)

g.__doc__ = f.__doc__ # Preserve docstrings for the inspect module
return g


Expand Down