wcs_api: adapt to change in formdefs API (fixes #20383)
This commit is contained in:
parent
212bdeddf7
commit
4ff37ebaa2
|
@ -2,10 +2,15 @@ import requests
|
|||
import urlparse
|
||||
import urllib
|
||||
import isodate
|
||||
import logging
|
||||
|
||||
|
||||
from . import signature
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class WcsApiError(Exception):
|
||||
pass
|
||||
|
||||
|
@ -217,7 +222,17 @@ class WcsApi(object):
|
|||
|
||||
@property
|
||||
def formdefs(self):
|
||||
return [FormDef(wcs_api=self, **d) for d in self.get_json(self.formdefs_url)
|
||||
result = self.get_json(self.formdefs_url)
|
||||
if isinstance(result, dict):
|
||||
if result['err'] == 0:
|
||||
data = result['data']
|
||||
else:
|
||||
logger.error(u'could not retrieve formdefs from %s, err_desc: %s',
|
||||
self.formdefs_url, result.get('err_desc'))
|
||||
return []
|
||||
else:
|
||||
data = result
|
||||
return [FormDef(wcs_api=self, **d) for d in data
|
||||
if not self.slugs or d['slug'] in self.slugs]
|
||||
|
||||
@property
|
||||
|
|
Loading…
Reference in New Issue