Exemplo n.º 1
0
    def __init__(self, data = None):
        if data == None:
            return
        self.label = data.get('label')
        if (data.get('name', None)):
            self.name = slugify(str(data.get('name')), max_length=30, separator="_")
        else:
            self.name = slugify(str(data.get('label')), max_length=30, separator="_")

        #check if name is already taken
        if Dataset.by_name(self.name):
            for x in range(10):
                newname = self.name + "_" + str(x)
                if not Dataset.by_name(newname):
                    self.name = newname
                    break


        self.description = data.get('description')
        self.ORoperations = data.get('ORoperations', {})
        self.mapping = data.get('mapping', {})
        self.prefuncs = data.get('prefuncs', {})
        self.created_at = datetime.utcnow()
        self.dataType = data.get('dataType')
        if type(data.get('dataorg')) == int:
            self.dataorg = DataOrg.by_id(data.get('dataorg'))
        else:
            try:
                self.dataorg = data.get('dataorg')
            except Exception, e:
                print "failed to load the dataorg for dataset"
                print e
Exemplo n.º 2
0
    def __init__(self, data=None):
        if data == None:
            return
        self.label = data.get('label')
        if (data.get('name', None)):
            self.name = slugify(str(data.get('name')),
                                max_length=30,
                                separator="_")
        else:
            self.name = slugify(str(data.get('label')),
                                max_length=30,
                                separator="_")

        #check if name is already taken
        if Dataset.by_name(self.name):
            for x in range(10):
                newname = self.name + "_" + str(x)
                if not Dataset.by_name(newname):
                    self.name = newname
                    break

        self.description = data.get('description')
        self.ORoperations = data.get('ORoperations', {})
        self.mapping = data.get('mapping', {})
        self.prefuncs = data.get('prefuncs', {})
        self.created_at = datetime.utcnow()
        self.dataType = data.get('dataType')
        if type(data.get('dataorg')) == int:
            self.dataorg = DataOrg.by_id(data.get('dataorg'))
        else:
            try:
                self.dataorg = data.get('dataorg')
            except Exception, e:
                print "failed to load the dataorg for dataset"
                print e
Exemplo n.º 3
0
    def update(self, data):
        #not to update name
        self.label = data.get('label')
        if (data.get('name', None)):
            self.name = slugify(str(data.get('name')), max_length=30, separator="_")
        else:
            self.name = slugify(str(data.get('label')), max_length=30, separator="_")

            
        self.description = data.get('description')
        self.dataType = data.get('dataType')
        self.dataorg = DataOrg.by_id(data.get('dataorg'))
Exemplo n.º 4
0
    def update(self, data):
        #not to update name
        self.label = data.get('label')
        if (data.get('name', None)):
            self.name = slugify(str(data.get('name')),
                                max_length=30,
                                separator="_")
        else:
            self.name = slugify(str(data.get('label')),
                                max_length=30,
                                separator="_")

        self.description = data.get('description')
        self.dataType = data.get('dataType')
        self.dataorg = DataOrg.by_id(data.get('dataorg'))