Refactoring page creation code [dm1]

This commit is contained in:
Alexey Verkhovsky 2005-05-12 01:07:24 +00:00
parent f6a3b88693
commit 9abb4f575a
5 changed files with 29 additions and 34 deletions

View file

@ -44,10 +44,12 @@ class Web
def max_upload_size() @max_upload_size || 100; end
def wiki() @wiki ||= WikiService.instance; end
def add_page(page)
@pages[page.name] = page
end
def add_page(name, content, created_at, author)
page = Page.new(self, name)
@pages[page.name] = page
page.revise(content, created_at, author)
end
def address=(the_address)
if the_address != CGI.escape(the_address)
raise Instiki::ValidationError.new('Web name should contain only valid URI characters')