Changeset 750:e25458e9bfb1 in hatta-dev


Ignore:
Timestamp:
01/25/10 15:16:53 (2 years ago)
Author:
sheep@…
Branch:
default
Message:

catch another corner case of subdriectory repo

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • hatta.py

    r749 r750  
    706706        try: 
    707707            os.makedirs(dir_path) 
    708         except OSError: 
    709             pass 
     708        except OSError, e: 
     709            if e.errno != 17 or not os.path.isdir(dir_path): 
     710                raise werkzeug.exceptions.Forbidden( 
     711                    _(u"Can't make subpages of existing pages")) 
    710712        super(WikiSubdirectoryStorage, self).save_file(title, file_name, 
    711713                                                       author, comment, parent) 
  • tests/test_repo.py

    r747 r750  
    116116        assert not exists 
    117117 
     118    def test_create_parent(self, subdir_repo): 
     119        """ 
     120        Make sure you can't create a parent page of existsing page. 
     121        """ 
     122 
     123        subdir_repo.save_text(u'xxx/yyy', self.text, self.author, self.comment, 
     124                              parent=-1) 
     125        py.test.raises(werkzeug.exceptions.Forbidden, subdir_repo.save_text, 
     126                       u'xxx', self.text, self.author, self.comment, 
     127                       parent=-1) 
     128 
     129    def test_create_subpage(self, subdir_repo): 
     130        """ 
     131        Make sure you can't create a subpage of existsing page. 
     132        """ 
     133 
     134        subdir_repo.save_text(u'xxx', self.text, self.author, self.comment, 
     135                              parent=-1) 
     136        py.test.raises(werkzeug.exceptions.Forbidden, subdir_repo.save_text, 
     137                       u'xxx/yyy', self.text, self.author, self.comment, 
     138                       parent=-1) 
    118139 
    119140class TestMercurialStorage(object): 
     
    226247        py.test.raises(werkzeug.exceptions.Forbidden, repo.delete_page, 
    227248                       self.title, self.author, self.comment) 
     249 
    228250 
    229251class TestStorage(object): 
Note: See TracChangeset for help on using the changeset viewer.