changeset 2080:1e18f9e4f228

Merged Thomas' fix to the unignorable edit-log problem.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Sat, 02 Jun 2007 16:56:17 +0200
parents 03469a83dad8 (current diff) 967d529b31e9 (diff)
children 6c3ae1a407a0
files wiki/data/edit-log
diffstat 10 files changed, 57 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_user.py	Sat Jun 02 16:55:35 2007 +0200
+++ b/MoinMoin/_tests/test_user.py	Sat Jun 02 16:56:17 2007 +0200
@@ -136,7 +136,36 @@
         theUser = user.User(self.request, name=name, password=password)
         self.assertEqual(theUser.enc_password, expected,
                          "User password was not replaced with new")
+        
+    def testSubscriptionSubscribedPage(self):
+        """ user: tests isSubscribedTo  """
+        pagename = u'HelpMiscellaneous'
+        name = u'__Jürgen Herman__'
+        password = name
+        self.createUser(name, password, charset='iso-8859-1')
+        # Login - this should replace the old password in the user file
+        theUser = user.User(self.request, name=name, password=password)
+        theUser.subscribe(pagename)
+        expected = True
+        result = theUser.isSubscribedTo(pagename)
+        self.assertEqual(result, expected,
+                 'Expected "%(expected)s" but got "%(result)s"' % locals())
 
+    def testSubscriptionSubPage(self):
+        """ user: tests isSubscribedTo on a subpage """
+        pagename = u'HelpMiscellaneous'
+        testPagename = u'HelpMiscellaneous/FrequentlyAskedQuestions'
+        name = u'__Jürgen Herman__'
+        password = name
+        self.createUser(name, password, charset='iso-8859-1')
+        # Login - this should replace the old password in the user file
+        theUser = user.User(self.request, name=name, password=password)
+        theUser.subscribe(pagename)
+        expected = False
+        result = theUser.isSubscribedTo(testPagename)
+        self.assertEqual(result, expected,
+                 'Expected "%(expected)s" but got "%(result)s"' % locals())
+        
     # Helpers ---------------------------------------------------------
 
     def createUser(self, name, password, charset='utf-8'):
--- a/MoinMoin/action/edit.py	Sat Jun 02 16:55:35 2007 +0200
+++ b/MoinMoin/action/edit.py	Sat Jun 02 16:56:17 2007 +0200
@@ -107,6 +107,10 @@
 
     if cancelled:
         pg.sendCancel(savetext or "", rev)
+        pagedir = pg.getPagePath(check_create=0)
+        import os
+        if not os.listdir(pagedir):
+            os.removedirs(pagedir)
         return
 
     comment = wikiutil.clean_input(comment)
--- a/MoinMoin/auth/__init__.py	Sat Jun 02 16:55:35 2007 +0200
+++ b/MoinMoin/auth/__init__.py	Sat Jun 02 16:56:17 2007 +0200
@@ -16,6 +16,8 @@
                  [login only]
        password: the value of the 'password' form field (or None)
                  [login only]
+       cookie: a Cookie.SimpleCookie instance containing the cookie
+               that the browser sent
        multistage: boolean indicating multistage login continuation
                    [may not be present, login only]
 
--- a/MoinMoin/auth/php_session.py	Sat Jun 02 16:55:35 2007 +0200
+++ b/MoinMoin/auth/php_session.py	Sat Jun 02 16:56:17 2007 +0200
@@ -49,6 +49,7 @@
 
             return dec(username), dec(email), dec(name)
 
+        cookie = kw.get('cookie')
         if not cookie is None:
             for cookiename in cookie:
                 cookievalue = urllib.unquote(cookie[cookiename].value).decode('iso-8859-1')
--- a/MoinMoin/auth/smb_mount.py	Sat Jun 02 16:55:35 2007 +0200
+++ b/MoinMoin/auth/smb_mount.py	Sat Jun 02 16:56:17 2007 +0200
@@ -39,9 +39,6 @@
         web_username = self.smb_dir_user
         web_uid = pwd.getpwnam(web_username)[2] # XXX better just use current uid?
 
-        if not login: # logout -> we don't have username in form
-            username = user_obj.name # so we take it from previous auth method
-
         mountpoint = self.smb_mountpoint_fn(username)
         if login:
             cmd = u"sudo mount -t cifs -o user=%(user)s,domain=%(domain)s,uid=%(uid)d,dir_mode=%(dir_mode)s,file_mode=%(file_mode)s,iocharset=%(iocharset)s //%(server)s/%(share)s %(mountpoint)s >>%(log)s 2>&1"
@@ -74,10 +71,10 @@
         username = kw.get('username')
         password = kw.get('password')
         if user_obj and user_obj.valid:
-            do_smb(request, username, password, True)
+            self.do_smb(request, username, password, True)
         return ContinueLogin(user_obj)
 
     def logout(self, request, user_obj, **kw):
         if user_obj and not user_obj.valid:
-            do_smb(request, None, None, False)
+            self.do_smb(request, user_obj.name, None, False)
         return user_obj, True
--- a/MoinMoin/logfile/__init__.py	Sat Jun 02 16:55:35 2007 +0200
+++ b/MoinMoin/logfile/__init__.py	Sat Jun 02 16:56:17 2007 +0200
@@ -143,8 +143,18 @@
                 # Open the file (NOT using codecs.open, it breaks our offset calculation. We decode it later.).
                 # Use binary mode in order to retain \r - otherwise the offset calculation would fail.
                 self._input = file(self.__filename, "rb",)
-            except IOError:
-                raise StopIteration
+            except IOError, err:
+                if err.errno == 2: # POSIX errno.ENOENT "file not found"
+                    try:
+                        # XXX workaround if edit-log does not exist: just create it empty
+                        f = file(self.__filename, "ab")
+                        f.write('')
+                        f.close()
+                        self._input = file(self.__filename, "rb",)
+                        return self._input
+                    except:
+                        pass
+                    raise StopIteration
             return self._input
         elif name == "_output":
             self._output = codecs.open(self.__filename, 'a', config.charset)
--- a/MoinMoin/macro/WantedPages.py	Sat Jun 02 16:55:35 2007 +0200
+++ b/MoinMoin/macro/WantedPages.py	Sat Jun 02 16:56:17 2007 +0200
@@ -26,7 +26,7 @@
     label = (_('Include system pages'), _('Exclude system pages'))[allpages]
     page = macro.formatter.page
     controlbar = macro.formatter.div(1, css_class="controlbar") + \
-                 page.link_to(request, label, querystr={'allpages': '%d' % allpages and '0' or '1'}) + \
+                 page.link_to(request, label, querystr={'allpages': '%s' % (allpages and '0' or '1')}) + \
                  macro.formatter.div(0)
 
     # Get page dict readable by current user
--- a/MoinMoin/parser/text_moin_wiki.py	Sat Jun 02 16:55:35 2007 +0200
+++ b/MoinMoin/parser/text_moin_wiki.py	Sat Jun 02 16:56:17 2007 +0200
@@ -3,7 +3,7 @@
     MoinMoin - MoinMoin Wiki Markup Parser
 
     @copyright: 2000-2002 Juergen Hermann <jh@web.de>,
-                2006 by MoinMoin:ThomasWaldmann
+                2006-2007 MoinMoin:ThomasWaldmann,
                 2007 by MoinMoin:ReimarBauer
     @license: GNU GPL, see COPYING for details.
 """
@@ -66,7 +66,7 @@
 
     # the big, fat, ugly one ;)
     formatting_rules = ur"""(?P<ent_numeric>&#(\d{1,5}|x[0-9a-fA-F]+);)
-(?:(?P<emph_ibb>'''''(?=[^']+'''))
+(?P<emph_ibb>'''''(?=[^']+'''))
 (?P<emph_ibi>'''''(?=[^']+''))
 (?P<emph_ib_or_bi>'{5}(?=[^']))
 (?P<emph>'{2,3})
@@ -82,7 +82,7 @@
 (?P<remark>(/\* ?| ?\*/))
 (?P<rule>-{4,})
 (?P<comment>^\#\#.*$)
-(?P<macro>\[\[(%%(macronames)s)(?:\(.*?\))?\]\]))
+(?P<macro>\[\[(%%(macronames)s)(?:\(.*?\))?\]\])
 (?P<ol>%(ol_rule)s)
 (?P<dl>%(dl_rule)s)
 (?P<li>^\s+\*\s*)
--- a/MoinMoin/request/__init__.py	Sat Jun 02 16:55:35 2007 +0200
+++ b/MoinMoin/request/__init__.py	Sat Jun 02 16:56:17 2007 +0200
@@ -611,7 +611,9 @@
         login = kw.get('login')
         logout = kw.get('logout')
         stage = kw.get('stage')
-        extra = {}
+        extra = {
+            'cookie': self._cookie,
+        }
         if login:
             extra['attended'] = attended
             extra['username'] = username
--- a/wiki/data/edit-log	Sat Jun 02 16:55:35 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-1172193184000000	00000002	SAVE	WikiSandBox	127.0.0.1	localhost