commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue/common/src FileUtils.py


From: Jan Ischebeck
Subject: gnue/common/src FileUtils.py
Date: Tue, 08 Oct 2002 17:29:43 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Jan Ischebeck <address@hidden>  02/10/08 17:29:43

Modified files:
        common/src     : FileUtils.py 

Log message:
        fix "gncvs test.gear" calling forms.
        allow "gear://samples%2Fsamples.gear/myfile.gfd" URLs now

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/FileUtils.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: gnue/common/src/FileUtils.py
diff -c gnue/common/src/FileUtils.py:1.2 gnue/common/src/FileUtils.py:1.3
*** gnue/common/src/FileUtils.py:1.2    Wed Sep 18 09:46:18 2002
--- gnue/common/src/FileUtils.py        Tue Oct  8 17:29:43 2002
***************
*** 75,85 ****
--- 75,87 ----
    else:
      (urltype, host, path, param, query, frag) = urlparse.urlparse(resource)
  
+     # check for .gear files
      if resource[-5:]==".gear":
        host=resource
        path=""
        urltype="gear"
  
+     # normal files are directly passed to the application
      if urltype!="gear":
        return urllib.urlopen(resource)
  
***************
*** 87,92 ****
--- 89,95 ----
        
        from gnue.common.gear.GearSystem import GearFileSystem
  
+       # fix for a bug in URLPARSE
        if host=="":
          # path="//host/path" -> path=path host=host
          pathlist=string.split(path[2:],"/",1)
***************
*** 96,105 ****
        # check if host ends in ".gear"
        if host[-5:]!=".gear":
          host=host+".gear"
!   
        # 1. search for gear in the local directory
        try:
!         gear=GearFileSystem(host)
          
        except:
          # 2. search in the package directory
--- 99,108 ----
        # check if host ends in ".gear"
        if host[-5:]!=".gear":
          host=host+".gear"
! 
        # 1. search for gear in the local directory
        try:
!         gear=GearFileSystem(urllib.unquote(host))
          
        except:
          # 2. search in the package directory
***************
*** 108,114 ****
          else:
            host=os.environ["HOME"]+"/gnue/packages/"+host
        
!         gear=GearFileSystem(host)
  
        if len(path):
          return gear.openFile(path)
--- 111,117 ----
          else:
            host=os.environ["HOME"]+"/gnue/packages/"+host
        
!         gear=GearFileSystem(urllib.unquote(host))
  
        if len(path):
          return gear.openFile(path)
***************
*** 118,129 ****
  
          # check if the zip file contains a default navigator file
          if gear.hasFile("default.gpd"):
            return gear.openFile("default.gpd")
            
  
!           # convert a single filename to a full gear url
          if resource[:5]!="gear:":
!           resource="gear://"+resource+"/"
  
          filelist = gear.getArchiveListing()
          
--- 121,138 ----
  
          # check if the zip file contains a default navigator file
          if gear.hasFile("default.gpd"):
+           # TODO: change navigator file and add relative paths
+           # i.e. in case of gear-resource="sample/test.gear"
+           #      gear://test.gear/mypath/my.gfd ->
+           #      gear://sample%2Ftest.gear/mypath/my.gfd
            return gear.openFile("default.gpd")
            
  
!         # convert a single filename to a full gear url
          if resource[:5]!="gear:":
!           resource="gear://"+urllib.quote(resource,"")+"/"
!           
!         gear._gearFileRes=resource
  
          filelist = gear.getArchiveListing()
          




reply via email to

[Prev in Thread] Current Thread [Next in Thread]