changeset 4936:1c8da2f463ee

merged moin/1.8
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 07 Aug 2009 10:58:53 +0200
parents 6c4c93f896f8 (current diff) a6b0b1fcd463 (diff)
children ba2306094975 bd1bbdb40a5f
files MoinMoin/action/diff.py MoinMoin/action/revert.py MoinMoin/util/filesys.py MoinMoin/widget/browser.py
diffstat 6 files changed, 20 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/diff.py	Fri Aug 07 09:58:15 2009 +0200
+++ b/MoinMoin/action/diff.py	Fri Aug 07 10:58:53 2009 +0200
@@ -118,12 +118,12 @@
     title = f.text(title)
 
     # Revision list starts from 2...
-    if oldrev == min(revlist):
+    if oldrev <= min(revlist):
         disable_prev = u' disabled="disabled"'
     else:
         disable_prev = u''
 
-    if newrev == max(revlist):
+    if newrev >= max(revlist):
         disable_next = u' disabled="disabled"'
     else:
         disable_next = u''
--- a/MoinMoin/action/revert.py	Fri Aug 07 09:58:15 2009 +0200
+++ b/MoinMoin/action/revert.py	Fri Aug 07 10:58:53 2009 +0200
@@ -9,6 +9,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 from MoinMoin import wikiutil
+from MoinMoin.Page import Page
 from MoinMoin.PageEditor import PageEditor
 from MoinMoin.action import ActionBase
 
@@ -36,7 +37,7 @@
     def check_condition(self):
         """ checks valid page and rev """
         _ = self._
-        if not self.request.rev:
+        if not self.request.rev or Page(self.request, self.pagename).current_rev() == self.request.rev:
             # same string as in PageEditor...
             note = _('You were viewing the current revision of this page when you called the revert action. '
                      'If you want to revert to an older revision, first view that older revision and '
--- a/MoinMoin/auth/ldap_login.py	Fri Aug 07 09:58:15 2009 +0200
+++ b/MoinMoin/auth/ldap_login.py	Fri Aug 07 10:58:53 2009 +0200
@@ -83,6 +83,7 @@
         tls_require_cert=0, # 0 == ldap.OPT_X_TLS_NEVER (needed for self-signed certs)
         bind_once=False, # set to True to only do one bind - useful if configured to bind as the user on the first attempt
         autocreate=False, # set to True if you want to autocreate user profiles
+        name='ldap', # use e.g. 'ldap_pdc' and 'ldap_bdc' (or 'ldap1' and 'ldap2') if you auth against 2 ldap servers
         ):
         self.server_uri = server_uri
         self.bind_dn = bind_dn
@@ -111,6 +112,7 @@
 
         self.bind_once = bind_once
         self.autocreate = autocreate
+        self.name = name
 
     def login(self, request, user_obj, **kw):
         username = kw.get('username')
@@ -231,13 +233,14 @@
                 u.name = username
                 u.aliasname = aliasname
                 u.remember_me = 0 # 0 enforces cookie_lifetime config param
-                logging.debug("creating userprefs with name %r email %r alias %r" % (username, email, aliasname))
+                logging.debug("creating user object with name %r email %r alias %r" % (username, email, aliasname))
 
             except ldap.INVALID_CREDENTIALS, err:
                 logging.debug("invalid credentials (wrong password?) for dn %r (username: %r)" % (dn, username))
                 return CancelLogin(_("Invalid username or password."))
 
             if u and self.autocreate:
+                logging.debug("calling create_or_update to autocreate user %r" % u.name)
                 u.create_or_update(True)
             return ContinueLogin(u)
 
--- a/MoinMoin/config/__init__.py	Fri Aug 07 09:58:15 2009 +0200
+++ b/MoinMoin/config/__init__.py	Fri Aug 07 10:58:53 2009 +0200
@@ -76,6 +76,7 @@
                'mailto', 'nntp', 'news',
                'ssh', 'telnet', 'irc', 'ircs', 'xmpp', 'mumble',
                'webcal', 'ed2k', 'rootz',
+               'gopher',
                'notes',
               ]
 
--- a/MoinMoin/util/filesys.py	Fri Aug 07 09:58:15 2009 +0200
+++ b/MoinMoin/util/filesys.py	Fri Aug 07 10:58:53 2009 +0200
@@ -146,9 +146,11 @@
             # trick
             now = int(time.time())
             if now >= st.st_mtime + max_staleness:
-                fake_mtime = now
+                # keep same fake_mtime for each max_staleness interval
+                fake_mtime = int(now / max_staleness) * max_staleness
         uid = (st.st_mtime,  # might have a rather rough granularity, e.g. 2s
-                             # on FAT and might not change on fast updates
+                             # on FAT, 1s on ext3 and might not change on fast
+                             # updates
                st.st_ino,  # inode number (will change if the update is done
                            # by e.g. renaming a temp file to the real file).
                            # not supported on win32 (0 ever)
--- a/MoinMoin/widget/browser.py	Fri Aug 07 09:58:15 2009 +0200
+++ b/MoinMoin/widget/browser.py	Fri Aug 07 10:58:53 2009 +0200
@@ -89,10 +89,13 @@
         del unique[0]
         unique.sort()
         result = [self._makeoption(item, item == value) for item in unique]
-        common = [None, None, None]
-        common[0] = self._makeoption(self._all, value == self.__all, self.__all)
-        common[1] = self._makeoption(self._empty, value == self.__empty, self.__empty)
-        common[2] = self._makeoption(self._notempty, value == self.__notempty, self.__notempty)
+        common = []
+        common.append(self._makeoption(self._all, value == self.__all, self.__all))
+        if '' in unique:
+            common.extend([
+                self._makeoption(self._empty, value == self.__empty, self.__empty),
+                self._makeoption(self._notempty, value == self.__notempty, self.__notempty),
+            ])
         return '\n'.join(common + result)
 
     def _format(self, formatter=None, method=None):