Revert "fix-api-params-handler"

This reverts commit 1272d4e6b0.
This commit is contained in:
Alex Yatskov 2017-05-28 11:03:20 -07:00
parent 1db470dcc1
commit 6b5d50b23a

View File

@ -445,15 +445,9 @@ class AnkiConnect:
def handler(self, request): def handler(self, request):
action = 'api_' + request.get('action', '') action = 'api_' + request.get('action', '')
params = request.get('params')
api_func = getattr(self, action)
if hasattr(self, action): if hasattr(self, action):
try: try:
if not params: return getattr(self, action)(**(request.get('params') or {}))
return api_func()
return api_func(params)
except TypeError: except TypeError:
return None return None
@ -466,8 +460,9 @@ class AnkiConnect:
return self.anki.modelNames() return self.anki.modelNames()
def api_modelFieldNames(self, params): def api_modelFieldNames(self, modelName):
return self.anki.modelFieldNames(params.get("modelName")) return self.anki.modelFieldNames(modelName)
def api_addNote(self, note): def api_addNote(self, note):
params = AnkiNoteParams(note) params = AnkiNoteParams(note)