def _register_ogp_service(url, owner=None):
 services = Service.objects.filter(base_url=url)
 if (services.count() > 0):
  service = services[0]
  return_dict = [{'status': 'ok', 'service_id': service.pk, 'service_name': service.name, 'service_title': service.title, 'msg': 'This is an existing Service'}]
  return return_dict
 service = Service.objects.create(base_url=url, type='OGP', method='H', name='OpenGeoPortal', title='OpenGeoPortal', abstract=OGP_ABSTRACT, owner=owner)
 service.set_default_permissions()
 if settings.USE_QUEUE:
  WebServiceHarvestLayersJob.objects.get_or_create(service=service)
 else:
  _harvest_ogp_layers(service, owner=owner)
 message = ('Service %s registered' % service.name)
 return_dict = [{'status': 'ok', 'msg': message, 'service_id': service.pk, 'service_name': service.name, 'service_title': service.title}]
 return HttpResponse(json.dumps(return_dict), content_type='application/json', status=200)

def _register_ogp_service ( url , owner = None ) : services = Service . objects . filter ( base_url = url ) if ( services . count ( ) > 0 ) : service = services [ 0 ] return_dict = [ { 'status' : 'ok' , 'service_id' : service . pk , 'service_name' : service . name , 'service_title' : service . title , 'msg' : 'This is an existing Service' } ] return return_dict service = Service . objects . create ( base_url = url , type = 'OGP' , method = 'H' , name = 'OpenGeoPortal' , title = 'OpenGeoPortal' , abstract = OGP_ABSTRACT , owner = owner ) service . set_default_permissions ( ) if settings . USE_QUEUE : WebServiceHarvestLayersJob . objects . get_or_create ( service = service ) else : _harvest_ogp_layers ( service , owner = owner ) message = ( 'Service %s registered' % service . name ) return_dict = [ { 'status' : 'ok' , 'msg' : message , 'service_id' : service . pk , 'service_name' : service . name , 'service_title' : service . title } ] return HttpResponse ( json . dumps ( return_dict ) , content_type = 'application/json' , status = 200 )
register opengeoportal as a service .