From: Tony Mack Date: Thu, 10 May 2012 14:42:58 +0000 (-0400) Subject: support recursive by inlcuding '*' at the end of the hrn X-Git-Tag: sfa-2.1-6~10 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=340b5ca25f2c34e52f586ec19c3153ccbb7940ea;p=sfa.git support recursive by inlcuding '*' at the end of the hrn --- diff --git a/sfa/managers/registry_manager.py b/sfa/managers/registry_manager.py index 01c6203d..78aecfda 100644 --- a/sfa/managers/registry_manager.py +++ b/sfa/managers/registry_manager.py @@ -187,6 +187,10 @@ class RegistryManager: def List (self, api, xrn, origin_hrn=None): hrn, type = urn_to_hrn(xrn) + recursive = False + if hrn.endswith('*'): + hrn = hrn[:-1] + recursive = True # load all know registry names into a prefix tree and attempt to find # the longest matching prefix registries = api.registries @@ -214,7 +218,10 @@ class RegistryManager: if not record_dicts: if not api.auth.hierarchy.auth_exists(hrn): raise MissingAuthority(hrn) - records = dbsession.query(RegRecord).filter_by(authority=hrn) + if recursive: + records = dbsession.query(RegRecord).filter(RegRecord.hrn.startswith(hrn)) + else: + records = dbsession.query(RegRecord).filter_by(authority=hrn) record_dicts=[ record.todict() for record in records ] return record_dicts