Changeset 739:11bdf1dc2e4b in hatta-dev
- Timestamp:
- 01/24/10 13:16:02 (2 years ago)
- Branch:
- default
- Files:
-
- 2 edited
-
hatta.py (modified) (4 diffs)
-
tests/test_repo.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
hatta.py
r732 r739 410 410 repo_file = self._title_to_file(title) 411 411 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")) 414 414 mercurial.util.rename(file_name, file_path) 415 415 changectx = self._changectx() … … 481 481 repo_file = self._title_to_file(title) 482 482 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")) 485 485 try: 486 486 os.unlink(file_path) … … 494 494 495 495 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")) 498 498 try: 499 499 return open(file_path, "rb") … … 1913 1913 except werkzeug.exceptions.Forbidden: 1914 1914 yield werkzeug.html.p( 1915 werkzeug.html(_(u"Can't edit symbolic links ")))1915 werkzeug.html(_(u"Can't edit symbolic links or directories"))) 1916 1916 return 1917 1917 if preview: -
tests/test_repo.py
r738 r739 101 101 assert self.title not in repo 102 102 103 def test_directory_read(self, repo): 104 """ 105 What happens when you try to read a directory as page. 106 """ 107 108 path = os.path.join(repo.path, self.filename) 109 os.mkdir(path) 110 py.test.raises(werkzeug.exceptions.Forbidden, repo.open_page, 111 self.title) 112 113 def test_directory_write(self, repo): 114 """ 115 What happens when you try to write a directory as page. 116 """ 117 118 path = os.path.join(repo.path, self.filename) 119 os.mkdir(path) 120 py.test.raises(werkzeug.exceptions.Forbidden, repo.save_text, 121 self.title, self.text, self.author, self.comment, 122 parent=-1) 123 124 def test_directory_delete(self, repo): 125 """ 126 What happens when you try to delete a directory as page. 127 """ 128 129 path = os.path.join(repo.path, self.filename) 130 os.mkdir(path) 131 py.test.raises(werkzeug.exceptions.Forbidden, repo.delete_page, 132 self.title, self.author, self.comment) 133 134 def test_symlink_delete(self, repo): 135 """ 136 What happens when you try to delete a symlink as page. 137 """ 138 139 path = os.path.join(repo.path, self.filename) 140 os.symlink('/', path) 141 py.test.raises(werkzeug.exceptions.Forbidden, repo.delete_page, 142 self.title, self.author, self.comment) 143 103 144 class TestStorage(object): 104 145 """
Note: See TracChangeset
for help on using the changeset viewer.
