コード例 #1
0
 def remove_local_component(self):
     id = self.request.form.get('id')
     if not id:
         return self.redirect_base(u'No id given')
     soup = getUtility(ISoup, name=id)
     root = StorageLocator(self.context).root
     root.getSiteManager().unregisterUtility(soup, ISoup, id)
     del soup
     transaction.commit()
     msg = '%s local component removed.' % id
     return self.redirect_base(msg)
コード例 #2
0
 def move_storage(self):
     id = self.request.form.get('id')
     if not id:
         return self.redirect_base(u'No id given')
     path = self.request.form.get('path')
     if not path:
         return self.redirect_base(u'No path given')
     locator = StorageLocator(self.context)
     try:
         target = locator.traverse(path)
     except ValueError:
         return self.redirect_base(u'Desired path not exists')
     method = self.request.form.get('moveormount')
     if method == 'move':
         locator.move(id, path)
         transaction.commit()
         return self.redirect_base(u'Moved storage of %s to %s' % (id, path))
     elif method == "mount":
         locator.relocate(id, path)
         transaction.commit()
         return self.redirect_base(u'Mounted storage %s to %s' % (id, path))
     else:
         return self.redirect_base(u'Invalid action (move or mount only)')
コード例 #3
0
 def storage_path(self, id):        
     try:
         path = StorageLocator(self.context).path(id)
     except KeyError, e:
         path = '/ (not initialized yet)'