summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author <bdauvergne@entrouvert.com>2009-09-21 13:14:56 (GMT)
committer <bdauvergne@entrouvert.com>2009-09-21 13:14:56 (GMT)
commitee33db1bb8d42d9ddfe67051dae305b311266ecb (patch)
treea86163b14fbee58aca79fdad64ea9b2611c2ac69
parent372fbc61682d8aa700d66f18654db4d9a755e5a5 (diff)
downloadpratic-ee33db1bb8d42d9ddfe67051dae305b311266ecb.zip
pratic-ee33db1bb8d42d9ddfe67051dae305b311266ecb.tar.gz
pratic-ee33db1bb8d42d9ddfe67051dae305b311266ecb.tar.bz2
* ignore errors for removed service_type when looking up services instances.
-rw-r--r--idp/extra/modules/directory.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/idp/extra/modules/directory.py b/idp/extra/modules/directory.py
index f106427..4c66212 100644
--- a/idp/extra/modules/directory.py
+++ b/idp/extra/modules/directory.py
@@ -474,10 +474,14 @@ def get_service_instances(collectivity):
# fill missing fields for global services
services = get_services()
for si in service_instances:
- s = get_service(si.cdg59serviceType)
- if s and s.cdg59isGlobal:
- si.cdg59metadataURL = s.cdg59metadataURL
- si.cdg59URL = s.cdg59URL
+ try:
+ s = get_service(si.cdg59serviceType)
+ if s and s.cdg59isGlobal:
+ si.cdg59metadataURL = s.cdg59metadataURL
+ si.cdg59URL = s.cdg59URL
+ except KeyError:
+ # ignore error for removed service type
+ continue
return service_instances
@@ -490,10 +494,14 @@ def get_service_instance(collectivity, siid):
raise KeyError()
si = ServiceInstance(result[0])
# fix missing field values for global services
- s = get_service(si.cdg59serviceType)
- if s and s.cdg59isGlobal:
- si.cdg59metadataURL = s.cdg59metadataURL
- si.cdg59URL = s.cdg59URL
+ try:
+ s = get_service(si.cdg59serviceType)
+ if s and s.cdg59isGlobal:
+ si.cdg59metadataURL = s.cdg59metadataURL
+ si.cdg59URL = s.cdg59URL
+ except KeyError:
+ # ignore error for removed service type
+ continue
return si