changeset 4736:d887cc013e76

merged moin/1.8
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 01 Jun 2009 14:08:52 +0200
parents 9b6b7ff7f5ac (current diff) 5eccbe592847 (diff)
children ebe54f59e87c
files MoinMoin/action/CopyPage.py MoinMoin/auth/http.py MoinMoin/theme/__init__.py
diffstat 4 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/CopyPage.py	Mon Jun 01 13:33:52 2009 +0200
+++ b/MoinMoin/action/CopyPage.py	Mon Jun 01 14:08:52 2009 +0200
@@ -13,6 +13,7 @@
 from MoinMoin.Page import Page
 from MoinMoin.PageEditor import PageEditor
 from MoinMoin.action import ActionBase
+from MoinMoin.security.textcha import TextCha
 
 class CopyPage(ActionBase):
     """ Copy page action
@@ -45,6 +46,11 @@
     def do_action(self):
         """ copy this page to "pagename" """
         _ = self._
+        # Currently we only check TextCha for upload (this is what spammers ususally do),
+        # but it could be extended to more/all attachment write access
+        if not TextCha(self.request).check_answer_from_form():
+            return status, _('TextCha: Wrong answer! Go back and try again...')
+
         form = self.form
         newpagename = form.get('newpagename', u'')
         newpagename = wikiutil.normalize_pagename(newpagename, self.cfg)
@@ -83,6 +89,7 @@
             subpages = ' '.join(self.users_subpages)
 
             d = {
+                'textcha': TextCha(self.request).render(),
                 'subpage': subpages,
                 'subpages_checked': ('', 'checked')[self.request.form.get('subpages_checked', '0') == '1'],
                 'subpage_label': _('Copy all /subpages too?'),
@@ -97,6 +104,7 @@
 <strong>%(querytext)s</strong>
 <br>
 <br>
+%(textcha)s
 <table>
     <tr>
     <dd>
@@ -131,12 +139,14 @@
 
         else:
             d = {
+                'textcha': TextCha(self.request).render(),
                 'pagename': wikiutil.escape(self.pagename, True),
                 'newname_label': _("New name"),
                 'comment_label': _("Optional reason for the copying"),
                 'buttons_html': buttons_html,
                 }
             return '''
+%(textcha)s
 <table>
     <tr>
         <td class="label"><label>%(newname_label)s</label></td>
--- a/MoinMoin/filter/EXIF.py	Mon Jun 01 13:33:52 2009 +0200
+++ b/MoinMoin/filter/EXIF.py	Mon Jun 01 14:08:52 2009 +0200
@@ -1105,12 +1105,12 @@
         self.den = den
 
     def __repr__(self):
-        self.reduce()
+        self.reduce_size()
         if self.den == 1:
             return str(self.num)
         return '%d/%d' % (self.num, self.den)
 
-    def reduce(self):
+    def reduce_size(self):
         div = gcd(self.num, self.den)
         if div > 1:
             self.num = self.num / div
--- a/MoinMoin/macro/EmbedObject.py	Mon Jun 01 13:33:52 2009 +0200
+++ b/MoinMoin/macro/EmbedObject.py	Mon Jun 01 14:08:52 2009 +0200
@@ -195,9 +195,11 @@
 }
 
     elif mt.major == 'application':
-        # workaround for the acroread not knowing the size to embed
+        # workaround for the acroread browser plugin not knowing the size to embed
+        # we use a width of 100% for the case that there is no width given.
+        # A height of 100% gives a fullscreen pdf file view without embedding it into the wikicontent.
         if mt.minor == 'pdf':
-            width = width or '800px'
+            width = width or '100%'
             height = height or '800px'
 
         embed_src = '''
--- a/MoinMoin/theme/__init__.py	Mon Jun 01 13:33:52 2009 +0200
+++ b/MoinMoin/theme/__init__.py	Mon Jun 01 14:08:52 2009 +0200
@@ -674,7 +674,7 @@
 
         msie_css = """
 <!-- css only for MS IE6/IE7 browsers -->
-<!--[if lt IE8]>
+<!--[if lt IE 8]>
    %s
 <![endif]-->
 """ % self._stylesheet_link(True, 'all', 'msie')