On Mon, 2 Dec 2013 16:22:04 -0500 Brian Theado <[email protected]> wrote:
> The http_bookmark_unl setting isn't working for me. It works as far as > opening the correct file, but the node hierarchy portion of the unl > fragment seems to be ignored. I `bzr blame` EKR :) Does it work if you restore that section to what it was in 4519? I'm not sure what EKR's amendment was for. Cheers -Terry > I see in the code exactly how to fix it for me, but I'm guessing I > don't understand the code properly because no-one else has complained > and I don't see how the code works for any cases. From the file > history, tt looks like Edward explicitly added the code which breaks > things, but I don't understand the intent. > > Here is some test code which duplicates the issue. Open a new outline > and paste this code in a new headline and hit Ctrl-b. The bookmark > will be created as a child of the current headline rather than at the > @mybookmarks-->Incoming node. > > ============================== > @language python > from leo.plugins.mod_http import LeoActions > > # Create target for bookmarks > target = ['@mybookmarks', 'Incoming'] > c.createNodeHierarchy(target) > c.redraw() > > # Dummy request handler. The 'add_bookmarks' method > # only uses the path attribute from it. Hard-code a > # path here to pretend we are bookmarking leoeditor.com > class req_handler: > path = "http://localhost:8080/?url=leoeditor.com&_form=1" > > # Instantiate LeoActions class and set it to use a > # hard-coded unl instead of the one from configuration > la = LeoActions(req_handler()) > la.bookmark_unl = c.fileName() + '#' + '-->'.join(target) > g.es(la.bookmark_unl) > > # Add the bookmark > la.add_bookmark() > ================================ > > Here's the code which seems to break things in add_bookmark: > > # EKR > i = path.find('#') > if i > -1: > path = path[:i].strip() > unl = path[i+1:].strip() > else: > path = path > unl = '' > > parsed = urlparse.urlparse(path) # self.bookmark_unl) # EKR > > > The if/else seems to be trying to do some of the job that urlparse is > meant to do and then breaks urlparse from being able to find the > fragment after the '#'. > > Can anyone shed some light? I'd rather not check in my fix until I > know it isn't going to re-break something. > > Brian > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/groups/opt_out.
