summaryrefslogtreecommitdiffstats
path: root/src/authentic2_pratic/management/commands/load-pratic-ldif.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/authentic2_pratic/management/commands/load-pratic-ldif.py')
-rw-r--r--src/authentic2_pratic/management/commands/load-pratic-ldif.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/authentic2_pratic/management/commands/load-pratic-ldif.py b/src/authentic2_pratic/management/commands/load-pratic-ldif.py
index 39132f0..9295fff 100644
--- a/src/authentic2_pratic/management/commands/load-pratic-ldif.py
+++ b/src/authentic2_pratic/management/commands/load-pratic-ldif.py
@@ -148,10 +148,17 @@ class PraticLDIFParser(ldif.LDIFParser):
service = self.services[entry['cdg59serviceType'][0]]
if not service.is_global and 'service_url' not in others:
others['service_url'] = 'http://missing-url-%s.com' % others['slug']
- service_instance = ServiceInstance(
+ try:
+ service_instance = ServiceInstance.objects.get(
collectivity=collectivity,
- service=service,
- **others)
+ service=service)
+ for k, v in others.iteritems():
+ setattr(service_instance, k, v)
+ except ServiceInstance.DoesNotExist:
+ service_instance = ServiceInstance(
+ collectivity=collectivity,
+ service=service,
+ **others)
try:
service_instance.clean()
except ValidationError, e: