[Moin-devel] CVS: MoinMoin Page.py,1.126,1.127 PageEditor.py,1.17,1.18

J?rgen Hermann jhermann at users.sourceforge.net
Wed Jun 5 11:44:04 EDT 2002


Update of /cvsroot/moin/MoinMoin
In directory usw-pr-cvs1:/tmp/cvs-serv23788/MoinMoin

Modified Files:
	Page.py PageEditor.py 
Log Message:
if the page file is read-only, you get a message


Index: Page.py
===================================================================
RCS file: /cvsroot/moin/MoinMoin/Page.py,v
retrieving revision 1.126
retrieving revision 1.127
diff -C2 -r1.126 -r1.127
*** Page.py	28 May 2002 22:42:02 -0000	1.126
--- Page.py	5 Jun 2002 18:43:22 -0000	1.127
***************
*** 79,82 ****
--- 79,87 ----
  
  
+     def isWritable(self):
+         """True if page can be changed"""
+         return os.access(self._text_filename(), os.W_OK)
+ 
+ 
      def exists(self):
          """True if the page exists"""

Index: PageEditor.py
===================================================================
RCS file: /cvsroot/moin/MoinMoin/PageEditor.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** PageEditor.py	28 May 2002 19:34:05 -0000	1.17
--- PageEditor.py	5 Jun 2002 18:43:23 -0000	1.18
***************
*** 50,53 ****
--- 50,58 ----
          webapi.http_headers(request, webapi.nocache)
  
+         if not self.isWritable():
+             self.send_page(request,
+                 msg=_('<b>Page is immutable!</b>'))
+             return
+ 
          if self.prev_date:
              print '<b>Cannot edit old revisions</b>'
***************
*** 387,391 ****
          if not request.user.may.edit:
              msg = _("""<b>You are not allowed to edit any pages.</b>""")
!         if not newtext:
              msg = _("""<b>You cannot save empty pages.</b>""")
          elif datestamp == '0':
--- 392,398 ----
          if not request.user.may.edit:
              msg = _("""<b>You are not allowed to edit any pages.</b>""")
!         elif not self.isWritable():
!             msg = _('<b>Page is immutable!</b>')
!         elif not newtext:
              msg = _("""<b>You cannot save empty pages.</b>""")
          elif datestamp == '0':





More information about the Moin-devel mailing list