Beispiel #1
0
 def delete(self, request, operation):
     operation = "/%s" % operation
     baseUrl = cleanUrl(settings.CATALOGUE_URL)
     conn = Connection(baseUrl)
     result = conn.request_delete(operation) #, headers={'Accept':'application/json'})
     response = HttpResponse(result['body'], mimetype='application/json; charset=UTF-8')
     return response
Beispiel #2
0
 def delete(self, request, operation):
     operation = "/%s" % operation
     baseUrl = cleanUrl(settings.CATALOGUE_URL)
     conn = Connection(baseUrl)
     result = conn.request_delete(
         operation)  #, headers={'Accept':'application/json'})
     response = HttpResponse(result['body'],
                             mimetype='application/json; charset=UTF-8')
     return response
Beispiel #3
0
 def share(self):
     if (self.uri == None) or (self.uri == ''):
         conn = Connection(cleanUrl(self.get_catalogue_url()))
         body = self.data
         result = conn.request_post('', body=body, headers={'Accept':'text/json'})
         if isValidResponse(result):
             self.data = result['body']
             obj = simplejson.loads(result['body'])
             self.uri = obj['uri']
             self.save()
         else:
             raise Exception(result['body'])
     else:
         conn = Connection(self.uri)
         result = conn.request_put('', body=self.data, headers={'Accept':'text/json'})
         if not isValidResponse(result):
             raise Exception(result['body'])
Beispiel #4
0
 def share(self):
     if (self.uri == None) or (self.uri == ''):
         conn = Connection(cleanUrl(self.get_catalogue_url()))
         body = self.data
         result = conn.request_post('',
                                    body=body,
                                    headers={'Accept': 'text/json'})
         if isValidResponse(result):
             self.data = result['body']
             obj = simplejson.loads(result['body'])
             self.uri = obj['uri']
             self.save()
         else:
             raise Exception(result['body'])
     else:
         conn = Connection(self.uri)
         result = conn.request_put('',
                                   body=self.data,
                                   headers={'Accept': 'text/json'})
         if not isValidResponse(result):
             raise Exception(result['body'])
Beispiel #5
0
class Command(BaseCommand):
    concepts_url = cleanUrl(settings.CATALOGUE_URL) + "/concepts"
    help = "Republish all the building block's into the catalogue"
    option_list = BaseCommand.option_list + (
        make_option('--concepts', '-c',
            action='store',
            dest='concepts_dir',
            type='string',
            help='Publish all the concepts stored in the parameter dir'),
        make_option('--all', '-a',
            action='store_true',
            dest='all',
            help='Share all the building blocks instead the previously shared ones'),
    )


    def handle(self, *args, **options):
        if options["all"]:
            bb_list = BuildingBlock.objects.all()
        else:
            bb_list = BuildingBlock.objects.exclude(uri=None)
        for bb in bb_list:
            bb = bb.child_model()
            if bb.uri != None and bb.uri != '':
                try:
                    print "Unsharing: %s" % bb.pk
                    bb.unshare()
                except Exception, e:
                    print "Cannot unshare: %s. Maybe the catalogue was emptied before?" % bb.pk
                    bb.uri = None
                    bb.save()

            bb.compile_code()
            try:
                print "Sharing %s" % bb.pk
                bb.share()
            except Exception, e:
                print "ERROR sharing: %s" % bb.pk
                print e
Beispiel #6
0
 def get_catalogue_url(self):
     return cleanUrl(settings.CATALOGUE_URL)  + "/services"
Beispiel #7
0
 def get_catalogue_url(self):
     return cleanUrl(settings.CATALOGUE_URL) + "/operators"
Beispiel #8
0
 def get_catalogue_url(self):
     return cleanUrl(settings.CATALOGUE_URL) + "/screenflows"
Beispiel #9
0
 def get_catalogue_url(self):
     return cleanUrl(settings.CATALOGUE_URL) + "/services"
Beispiel #10
0
 def get_catalogue_url(self):
     return cleanUrl(settings.CATALOGUE_URL) + "/operators"
Beispiel #11
0
 def get_catalogue_url(self):
     return cleanUrl(settings.CATALOGUE_URL) + "/screenflows"