Having Bug in finding subitem flag for items on index page

if subitem flag is true we get a "plus" sign after item name on index page, which when clicked takes to the index page of that item.

itemnames: "foo"

Current approach to get subitem flag is : i get the complete index (using get_index() function) and converts the list into string, and do regex search for the subitem in that string.

so string for above will look like "foo\nfoo/bar\nfoo/bar/baz"

so to get subitem flag for "foo" i do a regex search for "foo/" in above string (and i will get the flag as true)

but if i delete that "foo/bar" item, then in flat_index() for "foo" i wont be seeing "foo/bar" but if i do subitem search for "foo" i will get the result as true, because now the regex matches for "foo/bar/baz" Or it matches with that "Trash/foo/bar"

(Please try it once, to get the idea of what i am talking about)

reply usually you write a unit test at this state. It is much easier to work with a test than with repeating manually. Also if you write the unit test now you can be sure that your fix also fixes this problem

So at the time of implementation, this regex approach seemed efficient and working, but now it fails in some cases.

reply You need to alter the regex. e.g. ^foo/ use startswith ^. you can try kodos to find a suitable regex.

Thus the full-working approach to find subitem flag, will be to get flat_index() of each one, and if it returns something then make the flag as True (but again this method is too time taking and redundant).

Please tell what to do now.

comment

have you solved the branch merge issues?

MoinMoin: AkashSinha/Gsoc2011Diary/2011-08-20 (last edited 2011-08-22 11:01:42 by ReimarBauer)