def upgrade_mapped_uris_for_prefset(prefset):
    """Upgrade the mappedPaths preference."""

    # Komodo 4.3.0b1:
    # Update the mapped URI's to always be URI's, not just local file paths.
    # http://bugs.activestate.com/show_bug.cgi?id=74611

    if prefset.hasPrefHere("mappedPaths"):
        mapped_uris_modified = False
        encpathlist = prefset.getStringPref("mappedPaths")
        mapped_paths = encpathlist.split('::')
        new_mapped_paths = []
        for path in mapped_paths:
            data = path.split('##', 1)
            if len(data) == 2:
                # Update the path to be a URI.
                toURI = uriparse.pathToURI(data[1])
                if toURI != data[1]:
                    #print "upgraded mapped uri path from %r to %r" % (
                    #         data[1], toURI)
                    path = data[0] + '##' + toURI
                    mapped_uris_modified = True
            new_mapped_paths.append(path)
        if mapped_uris_modified:
            encpathlist = '::'.join(new_mapped_paths)
            prefset.setStringPref("mappedPaths", encpathlist)
Exemple #2
0
def upgrade_mapped_uris_for_prefset(prefset):
    """Upgrade the mappedPaths preference."""

    # Komodo 4.3.0b1:
    # Update the mapped URI's to always be URI's, not just local file paths.
    # http://bugs.activestate.com/show_bug.cgi?id=74611

    if prefset.hasPrefHere("mappedPaths"):
        mapped_uris_modified = False
        encpathlist = prefset.getStringPref("mappedPaths")
        mapped_paths = encpathlist.split('::')
        new_mapped_paths = []
        for path in mapped_paths:
            data = path.split('##', 1)
            if len(data) == 2:
                # Update the path to be a URI.
                toURI = uriparse.pathToURI(data[1])
                if toURI != data[1]:
                    #print "upgraded mapped uri path from %r to %r" % (
                    #         data[1], toURI)
                    path = data[0] + '##' + toURI
                    mapped_uris_modified = True
            new_mapped_paths.append(path)
        if mapped_uris_modified:
            encpathlist = '::'.join(new_mapped_paths)
            prefset.setStringPref("mappedPaths", encpathlist)
 def fileNotification(self, uri, flags):
     log.debug("fileNotification received %d for %r", flags, uri)
     # This url has changed, perform a status check
     self._cv.acquire()
     try:
         # Ensure the URI format is the same as used by koIFile.
         # http://bugs.activestate.com/show_bug.cgi?id=79065
         uri = uriparse.pathToURI(uri)
         # We only want to trigger background checking for the files we
         # are actually monitoring. Other file modifications should be
         # ignored.
         if uri in self._monitoredUrls:
             self._items_to_check.add((UnwrapObject(self._fileSvc.getFileFromURI(uri)),
                                       uri, self.REASON_FILE_CHANGED))
             self._cv.notify()
     finally:
         self._cv.release()
Exemple #4
0
 def fileNotification(self, uri, flags):
     log.debug("fileNotification received %d for %r", flags, uri)
     # This url has changed, perform a status check
     self._cv.acquire()
     try:
         # Ensure the URI format is the same as used by koIFile.
         # http://bugs.activestate.com/show_bug.cgi?id=79065
         uri = uriparse.pathToURI(uri)
         # We only want to trigger background checking for the files we
         # are actually monitoring. Other file modifications should be
         # ignored.
         if uri in self._monitoredUrls:
             self._items_to_check.add((UnwrapObject(self._fileSvc.getFileFromURI(uri)),
                                       uri, self.REASON_FILE_CHANGED))
             self._cv.notify()
     finally:
         self._cv.release()
 def test_pathToURI(self):
     remote_uri = "ftp://ftp.activestate.com/ActivePython"
     self.failUnlessSamePath(uriparse.pathToURI(remote_uri), remote_uri)