def move_storage(self): sid = self.request.form.get('id') if not sid: return self.redirect_base(u'No id given') path = self.request.form.get('path') locator = IStorageLocator(self.context) try: locator.traverse(path) except ValueError: return self.redirect_base(u'Desired path does not exist!') method = self.request.form.get('moveormount') if method == 'move': locator.move(sid, path) transaction.commit() return self.redirect_base(u'Moved storage of %s to %s' % (id, path)) elif method == "mount": locator.set_path(sid, 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)')
def move_storage(self): sid = self.request.form.get("id") if not sid: return self.redirect_base(u"No id given") path = self.request.form.get("path") locator = IStorageLocator(self.context) try: locator.traverse(path) except ValueError: return self.redirect_base(u"Desired path does not exist!") method = self.request.form.get("moveormount") if method == "move": locator.move(sid, path) transaction.commit() return self.redirect_base(u"Moved storage of %s to %s" % (sid, path)) elif method == "mount": locator.set_path(sid, path) transaction.commit() return self.redirect_base(u"Mounted storage %s to %s" % (sid, path)) else: return self.redirect_base(u"Invalid action (move or mount only)")
def storage_path(self, sid): locator = IStorageLocator(self.context) path = locator.path(sid) if not path.startswith("/"): path = "/" + path return path
def storage_path(self, sid): locator = IStorageLocator(self.context) path = locator.path(sid) if not path.startswith('/'): path = '/' + path return path