From 340b5ca25f2c34e52f586ec19c3153ccbb7940ea Mon Sep 17 00:00:00 2001
From: Tony Mack <tmack@paris.CS.Princeton.EDU>
Date: Thu, 10 May 2012 10:42:58 -0400
Subject: [PATCH] support recursive by inlcuding '*' at the end of the hrn

---
 sfa/managers/registry_manager.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

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
-- 
2.47.0