Ejemplo n.º 1
0
 def create_project(self, label, short_des):
     """ Creates a new project in the Manifest
         and projects tables
     """
     uuid = GenUUID.uuid4()
     man_proj = Manifest()
     man_proj.uuid = uuid
     man_proj.label = label
     man_proj.source_id = 'manual'
     man_proj.item_type = 'projects'
     man_proj.project_uuid = uuid
     man_proj.des_predicate_uuid = ''
     man_proj.class_uri = ''
     man_proj.views = 0
     man_proj.save()
     pobj = Project()
     pobj.uuid = uuid
     pobj.source_id = 'manual'
     pobj.project_uuid = uuid
     pobj.label = label
     pobj.edit_status = 0
     pobj.short_des = short_des
     pobj.content = ''
     pobj.save()
     return uuid
Ejemplo n.º 2
0
 def create_project(self, label, short_des):
     """ Creates a new project in the Manifest
         and projects tables
     """
     uuid = GenUUID.uuid4()
     man_proj = Manifest()
     man_proj.uuid = uuid
     man_proj.label = label
     man_proj.source_id = "manual"
     man_proj.item_type = "projects"
     man_proj.project_uuid = uuid
     man_proj.des_predicate_uuid = ""
     man_proj.class_uri = ""
     man_proj.views = 0
     man_proj.save()
     pobj = Project()
     pobj.uuid = uuid
     pobj.source_id = "manual"
     pobj.project_uuid = uuid
     pobj.label = label
     pobj.edit_status = 0
     pobj.short_des = short_des
     pobj.content = ""
     pobj.save()
     return uuid
Ejemplo n.º 3
0
 def create_project(self, post_data):
     """ creates a project item into a project
     """
     ok = True
     required_params = ['source_id', 'label', 'short_des']
     for r_param in required_params:
         if r_param not in post_data:
             # we're missing some required data
             # don't create the item
             ok = False
             message = 'Missing paramater: ' + r_param + ''
             if self.errors['params'] is False:
                 self.errors['params'] = message
             else:
                 self.errors['params'] += '; ' + message
     uuid = self.create_or_validate_uuid(post_data)
     if uuid is False:
         ok = False
         note = self.errors['uuid']
     if ok:
         label = post_data['label']
         if self.oc_root_project:
             project_uuid = uuid
         else:
             project_uuid = self.project_uuid
         new_proj = Project()
         new_proj.uuid = uuid
         new_proj.project_uuid = project_uuid
         new_proj.source_id = post_data['source_id']
         new_proj.edit_status = 0
         new_proj.label = label
         new_proj.short_des = post_data['short_des']
         new_proj.save()
         new_man = Manifest()
         new_man.uuid = uuid
         new_man.project_uuid = project_uuid
         new_man.source_id = post_data['source_id']
         new_man.item_type = 'projects'
         new_man.repo = ''
         new_man.class_uri = ''
         new_man.label = label
         new_man.des_predicate_uuid = ''
         new_man.views = 0
         new_man.save()
     else:
         label = '[Item not created]'
         uuid = False
     self.response = {
         'action': 'create-item-into',
         'ok': ok,
         'change': {
             'uuid': uuid,
             'label': label,
             'note': self.add_creation_note(ok)
         }
     }
     return self.response
Ejemplo n.º 4
0
 def create_project(self, post_data):
     """ creates a project item into a project
     """
     ok = True
     required_params = ['source_id',
                        'label',
                        'short_des']
     for r_param in required_params:
         if r_param not in post_data:
             # we're missing some required data
             # don't create the item
             ok = False
             message = 'Missing paramater: ' + r_param + ''
             if self.errors['params'] is False:
                 self.errors['params'] = message
             else:
                 self.errors['params'] += '; ' + message
     uuid = self.create_or_validate_uuid(post_data)
     if uuid is False:
         ok = False
         note = self.errors['uuid']
     if ok:
         label = post_data['label']
         if self.oc_root_project:
             project_uuid = uuid
         else:
             project_uuid = self.project_uuid
         new_proj = Project()
         new_proj.uuid = uuid
         new_proj.project_uuid = project_uuid
         new_proj.source_id = post_data['source_id']
         new_proj.edit_status = 0
         new_proj.label = label
         new_proj.short_des = post_data['short_des']
         new_proj.save()
         new_man = Manifest()
         new_man.uuid = uuid
         new_man.project_uuid = project_uuid
         new_man.source_id = post_data['source_id']
         new_man.item_type = 'projects'
         new_man.repo = ''
         new_man.class_uri = ''
         new_man.label = label
         new_man.des_predicate_uuid = ''
         new_man.views = 0
         new_man.save()
     else:
         label = '[Item not created]'
         uuid = False
     self.response = {'action': 'create-item-into',
                      'ok': ok,
                      'change': {'uuid': uuid,
                                 'label': label,
                                 'note': self.add_creation_note(ok)}}
     return self.response