Beispiel #1
0
 def updateNode(self,id,name,parentId):
     retVal = {}
     try:
         folder = DBSession().query(sar.Folder).get(id)
         # if this is a root folder, we don't allow any changes
         if folder.parentFolder is None:
             raise ClientException("You may not rename this folder")
         folder.name = name
         folder.parent_folder_id = parentId
         DBSession().flush()
         retVal=dict(msg='success')
     except ClientException, ce:
         # re-raise it
         raise ce
Beispiel #2
0
 def updateLeaf(self,id,name,parentId):
     retVal = {}
     try:
         file = DBSession().query(self.LeafClass).get(id)
         file.name = name
         if hasattr(file, 'folder_id'):
             file.folder_id = parentId
         elif hasattr(file, 'groupId'):
             file.groupId = parentId
         else:
             raise KeyError('')
         DBSession().flush()
         retVal=dict(msg='success')
     except Exception,e:
         retVal=dict(error = "Move failed")