MCPcopy
hub / github.com/pyload/pyload / apply

Method apply

module/lib/bottle.py:1444–1456  ·  view source on GitHub ↗
(self, callback, context)

Source from the content-addressed store, hash-verified

1442 self.json_dumps = json_dumps
1443
1444 def apply(self, callback, context):
1445 dumps = self.json_dumps
1446 if not dumps: return callback
1447 def wrapper(*a, **ka):
1448 rv = callback(*a, **ka)
1449 if isinstance(rv, dict):
1450 #Attempt to serialize, raises exception on failure
1451 json_response = dumps(rv)
1452 #Set content type only if serialization succesful
1453 response.content_type = 'application/json'
1454 return json_response
1455 return rv
1456 return wrapper
1457
1458
1459class HooksPlugin(object):

Callers 15

_make_callbackMethod · 0.45
_castMethod · 0.45
tFunction · 0.45
nFunction · 0.45
rFunction · 0.45
iFunction · 0.45
gaFunction · 0.45
xaFunction · 0.45
yaFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected