예제 #1
0
 def handle(self, request, data):
     try:
         params = {
             'visibility': 'public' if data['public'] else 'private',
             'protected': data['protected']
         }
         glance.metadefs_namespace_update(request,
                                          self.initial['namespace_id'],
                                          **params)
         msg = _('Namespace successfully updated.')
         messages.success(request, msg)
     except Exception:
         msg = _('Error updating attributes for namespace.')
         redirect = reverse(constants.METADATA_INDEX_URL)
         exceptions.handle(request, msg, redirect=redirect)
         return False
     return True
예제 #2
0
 def update_cell(self, request, datum, namespace_name, cell_name,
                 new_cell_value):
     # inline update namespace info
     try:
         namespace_obj = datum
         # updating changed value by new value
         if cell_name == 'public':
             cell_name = 'visibility'
             if new_cell_value:
                 new_cell_value = 'public'
             else:
                 new_cell_value = 'private'
         setattr(namespace_obj, cell_name, new_cell_value)
         properties = {cell_name: new_cell_value}
         glance.metadefs_namespace_update(request, namespace_name,
                                          **properties)
     except Exception:
         exceptions.handle(request, ignore=True)
         return False
     return True
예제 #3
0
파일: tables.py 프로젝트: 28607895/horizon
 def update_cell(self, request, datum, namespace_name,
                 cell_name, new_cell_value):
     # inline update namespace info
     try:
         namespace_obj = datum
         # updating changed value by new value
         if cell_name == 'public':
             cell_name = 'visibility'
             if new_cell_value:
                 new_cell_value = 'public'
             else:
                 new_cell_value = 'private'
         setattr(namespace_obj, cell_name, new_cell_value)
         properties = {cell_name: new_cell_value}
         glance.metadefs_namespace_update(
             request,
             namespace_name,
             **properties)
     except Exception:
         exceptions.handle(request, ignore=True)
         return False
     return True