Renaming a page does not update certain links of its children

Reported by aftermath on 2010-08-14
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Zim
High
Unassigned

Bug Description

This is somewhat related to the two previous bugs that I've submitted (both have been fixed), the most recent being #511481. I am running Zim 0.48 on Debian.

I've noticed something potentially improper when renaming a page with children in the specific case that the contents of those children reference each other. Following the format for creating an example that I used in the aforementioned bug report, consider the following simple hierarchy:

* TheParent "Loves [+FirstChild] and [+SecondChild]
** FirstChild "Hates the [SecondChild]"
** SecondChild "Loves the [FirstChild]"

If you rename TheParent to anything else, all of the following happens:
* TheParent is renamed to the new name (that makes sense)
* The relative link from TheParent to Child1 is preserved (that makes sense)
* The relative link from TheParent to Child2 is preserved (that makes sense)
* The content of Child1 is transported to a new page underneath the renamed parent (that makes sense)
* The link from Child1 to Child2 is converted from a relative link into an absolute link that reflects the OLD hierarchy, which no longer exists (that doesn't make sense)
* The content of Child2 is transported to a new page underneath the renamed parent (that makes sense)
* The link from Child2 to Child1 is converted from a relative link into an absolute link that reflects the OLD, which no longer exists (that doesn't make sense)

While I can actually see some advantage to calling this behavior a feature rather than a bug, I think that this simple example suggests just how much havoc such functionality could bring to a well organized notebook. The simple act of renaming a page should not irreversibly break a notebook and its references.

I suspect that the issue may go even deeper. Using the same initial sample hierarchy outlined above, instead of renaming TheParent create a new page called NewParent. If you move Child1 underneath NewParent then the link from Child1 to Child2 is converted into an absolute link and the link from Child2 to Child1 is converted into an absolute link. This makes sense. If you then move Child2 underneath NewParent then the link from Child1 to Child2 is converted back into a relative one, and the link from Child2 to Child1 remains absolute but correct. Technically, this makes sense, but it's not really what you want. What you want in this case is for both links to be relative again at the end like they were in the beginning. However, I understand the limitation. You basically have to make a decision that all links are either going to be aggressively re-factored into relative links whenever possible or always expanded out into full, absolute links. However, this simple moving example doesn't really do either. One is link ultimately has its relativity preserved while there other has it destroyed. It's not consistent. Moreover, it doesn't change the fact that the page renaming issue outlined above is very unacceptable.

aftermath (solaricus) wrote :

I apologize for adding onto this before my original comment was reviewed, but further testing has confirmed my that multiple behaviors are conspiring together to deliver an inconsistent and unpleasant workflow.

Basically, I attempted a manual "work around" of the bug described above. My "work around" was simply to convert the relative links of a sample notebook into hard-coded absolute links. The renaming of the parent was successful in the sense that the links of the children did update to the correct locations and didn't leave behind any references to the prior hierarchy. However, after the links were correctly updated they were then automatically collapsed down to relative links again. Thus, if I wanted to change the name of the parent again, I was back in the exact same position as I was before I my manual "work around".

I agree that the automatic collapsing of links down to their relative form IS the most desirable behavior. However, if this is going to be the default behavior then the issue which is the source of this bug report must be fixed. Otherwise, it's not only undesirable but also exacerbated by the behaviors of other commands.

Changed in zim:
status: New → Confirmed
importance: Undecided → High

I have the same problem with renaming as described. Here's a log:

This is zim 0.50
Python version is (2, 6, 6, 'final', 0)
Gtk version is (2, 22, 0)
Pygtk version is (2, 21, 0)
Platform is posix
Zim revision is:
  branch: pyzim-trunk
  revision: 350 <email address hidden>
  date: 2011-02-14 22:38:51 +0100

======= Traceback =======
  File "/usr/lib/pymodules/python2.6/zim/gui/__init__.py", line 1143, in _wrap_move_page
    func(update_links, callback)
  File "/usr/lib/pymodules/python2.6/zim/gui/__init__.py", line 1116, in <lambda>
    path, newbasename, update_heading, update_links, callback),
  File "/usr/lib/pymodules/python2.6/zim/notebook.py", line 1091, in rename_page
    self.move_page(path, newpath, update_links, callback)
  File "/usr/lib/pymodules/python2.6/zim/notebook.py", line 970, in move_page
    self.index.delete(path)
  File "/usr/lib/pymodules/python2.6/zim/index.py", line 712, in delete
    self.cleanup(link)
  File "/usr/lib/pymodules/python2.6/zim/index.py", line 790, in cleanup
    self.cleanup(parent) # recurs
  File "/usr/lib/pymodules/python2.6/zim/index.py", line 787, in cleanup
    if not (path.hascontent or path.haschildren) \
  File "/usr/lib/pymodules/python2.6/zim/index.py", line 132, in __getattr__
    raise AttributeError, 'This IndexPath does not contain row data'
AttributeError: This IndexPath does not contain row data

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers