Changeset 739:11bdf1dc2e4b in hatta-dev for hatta.py


Ignore:
Timestamp:
01/24/10 13:16:02 (2 years ago)
Author:
sheep@…
Branch:
default
Message:

add more tests for directories and symlinks, fix some related errors in Hatta

File:
1 edited

Legend:

Unmodified
Added
Removed
  • hatta.py

    r732 r739  
    410410        repo_file = self._title_to_file(title) 
    411411        file_path = self._file_path(title) 
    412         if os.path.islink(file_path): 
    413             raise werkzeug.exceptions.Forbidden(_(u"Can't edit symbolic links")) 
     412        if os.path.islink(file_path) or os.path.isdir(file_path): 
     413            raise werkzeug.exceptions.Forbidden(_(u"Can't edit symbolic links or directories")) 
    414414        mercurial.util.rename(file_name, file_path) 
    415415        changectx = self._changectx() 
     
    481481        repo_file = self._title_to_file(title) 
    482482        file_path = self._file_path(title) 
    483         if os.path.islink(file_path): 
    484             raise werkzeug.exceptions.Forbidden(_(u"Can't edit symbolic links")) 
     483        if os.path.islink(file_path) or os.path.isdir(file_path): 
     484            raise werkzeug.exceptions.Forbidden(_(u"Can't edit symbolic links or directories")) 
    485485        try: 
    486486            os.unlink(file_path) 
     
    494494 
    495495        file_path = self._file_path(title) 
    496         if os.path.islink(file_path): 
    497             raise werkzeug.exceptions.Forbidden(_(u"Can't read symbolic links")) 
     496        if os.path.islink(file_path) or os.path.isdir(file_path): 
     497            raise werkzeug.exceptions.Forbidden(_(u"Can't read symbolic links or directories")) 
    498498        try: 
    499499            return open(file_path, "rb") 
     
    19131913        except werkzeug.exceptions.Forbidden: 
    19141914            yield werkzeug.html.p( 
    1915                 werkzeug.html(_(u"Can't edit symbolic links"))) 
     1915                werkzeug.html(_(u"Can't edit symbolic links or directories"))) 
    19161916            return 
    19171917        if preview: 
Note: See TracChangeset for help on using the changeset viewer.