Ticket #2846: 0001-properly-parse-bundle_path-with-depth-greater-than-1.patch

File 0001-properly-parse-bundle_path-with-depth-greater-than-1.patch, 1.5 KB (added by walter, 13 years ago)

first pass at a patch

  • src/jarabe/view/viewsource.py

    From 1bd86b327772b06b16c5c2a71efdb6e115cf56d3 Mon Sep 17 00:00:00 2001
    From: Walter Bender <walter.bender@gmail.com>
    Date: Sat, 14 May 2011 11:04:40 -0400
    Subject: [PATCH] properly parse bundle_path with depth greater than 1
    Organization: Sugar Labs Foundation
    
    ---
     src/jarabe/view/viewsource.py |    8 ++++++--
     1 files changed, 6 insertions(+), 2 deletions(-)
    
    diff --git a/src/jarabe/view/viewsource.py b/src/jarabe/view/viewsource.py
    index a1c0be3..1dd06fb 100644
    a b class ViewSource(gtk.Window): 
    132132
    133133        activity_bundle = ActivityBundle(bundle_path)
    134134        command = activity_bundle.get_command()
     135        file_path = ''
    135136        if len(command.split(' ')) > 1:
    136             name = command.split(' ')[1].split('.')[0]
    137             file_name = name + '.py'
     137            name = command.split(' ')[1].split('.')[-1]
     138            tmppath = command.split(' ')[1].replace('.', '/')
     139            file_name = tmppath[0:-(len(name) + 1)] + '.py'
    138140            path = os.path.join(activity_bundle.get_path(), file_name)
    139141            self._selected_file = path
     142            logging.debug('view source: command %s, name %s, path %s' % (command, name, path))
    140143
     144        logging.debug('view source: file_path %s' % (file_path))
    141145        self._file_viewer = FileViewer(bundle_path, file_name)
    142146        self._file_viewer.connect('file-selected', self.__file_selected_cb)
    143147        pane.add1(self._file_viewer)