changeset 4360:d09af4cc80f9

merge moin/1.7
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 30 Sep 2008 09:38:41 +0200
parents af8e15c0d203 (current diff) 0bf173b2d64a (diff)
children adec0c4861f7
files MoinMoin/request/__init__.py wiki/htdocs/common/js/common.js
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/results.py	Mon Sep 29 00:02:49 2008 +0200
+++ b/MoinMoin/search/results.py	Tue Sep 30 09:38:41 2008 +0200
@@ -333,7 +333,7 @@
                 if page.attachment:
                     querydict = {
                         'action': 'AttachFile',
-                        'do': 'get',
+                        'do': 'view',
                         'target': page.attachment,
                     }
                 elif page.page.rev and page.page.rev != page.page.getRevList()[0]:
@@ -416,7 +416,7 @@
                     fmt_context = ""
                     querydict = {
                         'action': 'AttachFile',
-                        'do': 'get',
+                        'do': 'view',
                         'target': page.attachment,
                     }
                 elif page.page_name.startswith('FS/'): # XXX FS hardcoded
--- a/MoinMoin/security/textcha.py	Mon Sep 29 00:02:49 2008 +0200
+++ b/MoinMoin/security/textcha.py	Tue Sep 30 09:38:41 2008 +0200
@@ -89,8 +89,8 @@
                 self.answer_re = re.compile(self.answer_regex, re.U|re.I)
             except KeyError:
                 # this question does not exist, thus there is no answer
-                self.answer_regex = ur"[^.]*" # this shall never match!
-                self.answer_re = re.compile(self.answer_regex, re.U|re.I)
+                self.answer_regex = ur"[Never match for cheaters]"
+                self.answer_re = None
                 logging.warning(u"TextCha: Non-existing question '%s'. User '%s' trying to cheat?" % (
                                 self.question, self.user_info))
             except re.error:
@@ -116,7 +116,11 @@
     def check_answer(self, given_answer):
         """ check if the given answer to the question is correct """
         if self.is_enabled():
-            success = self.answer_re.match(given_answer.strip()) is not None
+            if self.answer_re is not None:
+                success = self.answer_re.match(given_answer.strip()) is not None
+            else:
+                # someone trying to cheat!?
+                success = False
             success_status = success and u"success" or u"failure"
             logging.info(u"TextCha: %s (u='%s', a='%s', re='%s', q='%s')" % (
                              success_status,