Mercurial > p > roundup > code
diff roundup/rest.py @ 6254:5b66c480f71f
Handle empty Link for transitive property
.. in REST API: If we request a transitive property in parameters (e.g.
author.username) and the Link is empty (None), we now return a username
of None and do not fail with a 404.
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Mon, 17 Aug 2020 18:14:12 +0200 |
| parents | 1cb2375015f0 |
| children | be8d5a8e090a |
line wrap: on
line diff
--- a/roundup/rest.py Fri Aug 07 00:27:56 2020 -0400 +++ b/roundup/rest.py Mon Aug 17 18:14:12 2020 +0200 @@ -627,6 +627,12 @@ cl = self.db.getclass(cn) nd = cl.getnode(id) id = v = getattr(nd, p) + # Handle transitive properties where something on + # the road is None (empty Link property) + if id is None : + prop = None + ok = True + break prop = cl.getprops(protected=True)[p] cn = getattr(prop, 'classname', None) else:
