Page(pagename).send_raw()
def do_savepage(pagename):
- if privileged_url is None:
- raise 'editing disallowed for ' + pagename
-
global form
pg = Page(pagename)
if 'preview' in form:
pg.save_text(form['savetext'].value)
pg.send_page()
elif 'cancel' in form:
- pg.msg = 'Editing cancelled'
+ pg.msg = 'Editing canceled'
pg.msg_type = 'notice'
pg.send_page()
else:
else:
return link_tag(word, word, 'nonexistent')
-
def get_raw_body(self):
try:
return open(self._text_filename(), 'rt').read()
if self.can_read():
PageFormatter(self.get_raw_body()).print_html()
else:
- print "<p>This page is not visible to you</p>"
+ send_guru("Read access denied by ACLs", "notice")
send_footer(page_name, self._last_modified())
def _last_modified(self):
def send_editor(self, preview=None):
send_title(None, 'Edit ' + self.split_title(), msg=self.msg, msg_type=self.msg_type)
+ if not self.can_write():
+ send_guru("Write access denied by ACLs", "error")
+ return
print ('<p><b>Editing ' + self.page_name
+ ' for ' + cgi.escape(remote_user())
send_footer(self.page_name)
def send_raw(self):
+ if not self.can_read():
+ send_title(None, msg='Read access denied by ACLs', msg_type='notice')
+ return
emit_header("text/plain")
print self.get_raw_body()
os.rename(tmp_filename, text)
def save_text(self, newtext):
+ if not self.can_write():
+ self.msg = 'Write access denied by ACLs'
+ self.msg_type = 'error'
+ return
+
self._write_file(newtext)
rc = 0
if post_edit_hook:
if msg:
self.msg += 'Output follows:\n' + msg
else:
- self.msg = 'Thankyou for your contribution. Your attention to detail is appreciated.'
+ self.msg = 'Thank you for your contribution. Your attention to detail is appreciated.'
self.msg_type = 'success'
def send_verbatim(filename, mime_type='application/octet-stream'):