Damien Accorsi 11 years ago
parent
commit
981a10a1ca
2 changed files with 4 additions and 2 deletions
  1. 2 0
      pboard/pboard/controllers/api.py
  2. 2 2
      pboard/pboard/lib/dbapi.py

+ 2 - 0
pboard/pboard/controllers/api.py View File

184
       # TODO - D.A. - 2013-11-07 - Check that new parent is accessible by the user !!!
184
       # TODO - D.A. - 2013-11-07 - Check that new parent is accessible by the user !!!
185
       loNewNode = loApiController.getNode(node_id)
185
       loNewNode = loApiController.getNode(node_id)
186
       if new_parent_id!='':
186
       if new_parent_id!='':
187
+        if new_parent_id==0:
188
+          new_parent_id = None
187
         loNewNode.parent_id = int(new_parent_id)
189
         loNewNode.parent_id = int(new_parent_id)
188
       pm.DBSession.flush()
190
       pm.DBSession.flush()
189
       redirect(lurl('/document/%s'%(node_id)))
191
       redirect(lurl('/document/%s'%(node_id)))

+ 2 - 2
pboard/pboard/lib/dbapi.py View File

264
     for loNode in loNodeList:
264
     for loNode in loNodeList:
265
       loTmpDict[loNode.node_id] = loNode
265
       loTmpDict[loNode.node_id] = loNode
266
   
266
   
267
-      if loNode.parent_id==None:
267
+      if loNode.parent_id==None or loNode.parent_id==0:
268
         loTreeList.append(loNode)
268
         loTreeList.append(loNode)
269
       else:
269
       else:
270
         # append the node to the parent list
270
         # append the node to the parent list
273
         # We suppose that the parent node has already been added
273
         # We suppose that the parent node has already been added
274
         # this *should* be the case, but the code does not check it
274
         # this *should* be the case, but the code does not check it
275
         if loNode.parent_id not in loTmpDict.keys():
275
         if loNode.parent_id not in loTmpDict.keys():
276
-          print('THE NODE =========',loNode.parent_id)
277
           try:
276
           try:
277
+
278
             loTmpDict[loNode.parent_id] = self.getNode(loNode.parent_id)
278
             loTmpDict[loNode.parent_id] = self.getNode(loNode.parent_id)
279
           except Exception as e:
279
           except Exception as e:
280
             # loTreeList.append(
280
             # loTreeList.append(