ability to send a new revision of a wiki page

This commit is contained in:
Romain Bignon 2010-10-16 10:06:04 +02:00
commit 66335a52c8
4 changed files with 38 additions and 9 deletions

View file

@ -43,22 +43,32 @@ class RedmineBackend(BaseBackend, ICapContent):
def create_default_browser(self):
return self.create_browser(self.config['url'], self.config['username'], self.config['password'])
def id2path(self, id):
return id.split('/', 2)
def get_content(self, id):
if isinstance(id, basestring):
try:
project, _type, page = id.split('/', 2)
except ValueError:
return None
content = Content(id)
else:
content = id
id = content.id
try:
project, _type, page = self.id2path(id)
except ValueError:
return None
with self.browser:
data = self.browser.get_wiki_source(project, page)
content.content = data
return content
def push_content(self, content):
pass
def push_content(self, content, message=None):
try:
project, _type, page = self.id2path(content.id)
except ValueError:
return
with self.browser:
return self.browser.set_wiki_source(project, page, content.content, message)