changeset 771:61b92dc8c32e

merge main
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 09 Jun 2006 21:36:41 +0200
parents 1c76112a5ff6 (current diff) 6389a1d32527 (diff)
children f9a0c40f082b
files
diffstat 6 files changed, 35 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/MANIFEST.in	Fri Jun 09 21:34:04 2006 +0200
+++ b/MANIFEST.in	Fri Jun 09 21:36:41 2006 +0200
@@ -10,7 +10,7 @@
 recursive-include docs *
 
 # include stuff for translators
-recursive-include   MoinMoin/i18n README Makefile *.txt *.py POTFILES.in *.po* *.mo
+recursive-include   MoinMoin/i18n *
 
 # contrib stuff
 recursive-include   contrib *
--- a/MoinMoin/parser/text_rst.py	Fri Jun 09 21:34:04 2006 +0200
+++ b/MoinMoin/parser/text_rst.py	Fri Jun 09 21:36:41 2006 +0200
@@ -306,13 +306,16 @@
         return html4css1.HTMLTranslator.astext(self)
 
     def fixup_wiki_formatting(self, text):
-        replacement = {'<p>': '', '</p>': '', '\n': '', '> ': '>'}
+        replacement = {'\n': '', '> ': '>'}
         for src, dst in replacement.items():
             text = text.replace(src, dst)
-        # Everything seems to have a space ending the text block. We want to
-        # get rid of this
-        if text and text[-1] == ' ':
-            text = text[:-1]
+        # Fixup extraneous markup
+        # Removes any empty span tags
+        text = re.sub(r'\s*<\s*span.*?>\s*<\s*/\s*span\s*>', '', text)
+        # Removes the first paragraph tag
+        text = re.sub(r'^\s*<\s*p[^>]*?>', '', text)
+        # Removes the ending paragraph close tag and any remaining whitespace
+        text = re.sub(r'<\s*/\s*p\s*>\s*$', '', text)
         return text
 
     def visit_reference(self, node):
@@ -339,8 +342,7 @@
                     (prefix == 'drawing') or
                     (prefix == 'inline')):
                 self.process_wiki_text(refuri)
-                # Don't call fixup_wiki_formatting because who knows what
-                # MoinMoin is inserting. (exits through add_wiki_markup)
+                self.wiki_text = self.fixup_wiki_formatting(self.wiki_text)
                 self.add_wiki_markup()
 
             # From here down, all links are handled by docutils (except 
@@ -352,6 +354,7 @@
                     # Attachment doesn't exist, give to MoinMoin to insert
                     # upload text.
                     self.process_wiki_text(refuri)
+                    self.wiki_text = self.fixup_wiki_formatting(self.wiki_text)
                     self.add_wiki_markup()
                 # Attachment exists, just get a link to it.
                 node['refuri'] = AttachFile.getAttachUrl(self.request.page.page_name, 
--- a/MoinMoin/userform.py	Fri Jun 09 21:34:04 2006 +0200
+++ b/MoinMoin/userform.py	Fri Jun 09 21:36:41 2006 +0200
@@ -8,7 +8,7 @@
 
 import string, time, re
 from MoinMoin import user, util, wikiutil
-from MoinMoin.util import web, mail, timefuncs
+from MoinMoin.util import web, timefuncs
 from MoinMoin.widget import html
 
 _debug = 0
--- a/MoinMoin/xmlrpc/__init__.py	Fri Jun 09 21:34:04 2006 +0200
+++ b/MoinMoin/xmlrpc/__init__.py	Fri Jun 09 21:36:41 2006 +0200
@@ -398,6 +398,12 @@
                  self._outstr(results.formatContext(hit, 180, 1)))
                 for hit in results.hits]
 
+    # XXX BEGIN WARNING XXX
+    # All xmlrpc_*Attachment* functions have to be considered as UNSTABLE API -
+    # they are neither standard nor are they what we need when we have switched
+    # attachments (1.5 style) to mimetype items (hopefully in 1.6).
+    # They are likely to get removed again when we remove AttachFile module.
+    # So use them on your own risk.
     def xmlrpc_listAttachments(self, pagename):
         """ Get all attachments associated with pagename
         
@@ -412,7 +418,7 @@
         
         result = AttachFile._get_files(self.request, pagename)
         return result
-        
+
     def xmlrpc_getAttachment(self, pagename, attachname):
         """ Get attachname associated with pagename
         
@@ -425,13 +431,13 @@
         # User may read page?
         if not self.request.user.may.read(pagename):
             return self.notAllowedFault()
-        
-        filename = wikiutil.taintfilename(filename)
-        filename = AttachFile.getFilename(self.request, pagename, attachname)
+
+        filename = wikiutil.taintfilename(self._instr(attachname))
+        filename = AttachFile.getFilename(self.request, pagename, filename)
         if not os.path.isfile(filename):
             return self.noSuchPageFault()
         return self._outlob(open(filename, 'rb').read())
-        
+
     def xmlrpc_putAttachment(self, pagename, attachname, data):
         """ Set attachname associated with pagename to data
         
@@ -462,6 +468,8 @@
         os.chmod(filename, 0666 & config.umask)
         AttachFile._addLogEntry(self.request, 'ATTNEW', pagename, filename)
         return xmlrpclib.Boolean(1)
+    
+    # XXX END WARNING XXX
 
     def process(self):
         """ xmlrpc v1 and v2 dispatcher """
--- a/docs/CHANGES	Fri Jun 09 21:34:04 2006 +0200
+++ b/docs/CHANGES	Fri Jun 09 21:36:41 2006 +0200
@@ -103,6 +103,7 @@
     * allow "-" in usernames (fixes "Invalid user name" msg)
     * fixed smiley caching bug (smileys didn't change theme)
     * fixed backtrace when user removed css_url entry from user_form_fields
+    * Fixed the output of macro and "attachment:" usages of the rst parser.
 
   Other changes:
     * we use (again) the same browser compatibility check as FCKeditor uses
--- a/setup.py	Fri Jun 09 21:34:04 2006 +0200
+++ b/setup.py	Fri Jun 09 21:36:41 2006 +0200
@@ -235,6 +235,15 @@
         'MoinMoin._tests',
     ],
 
+    # TODO package_dir and package_data only works for python >= 2.4
+    # in case we don't require python >= 2.4 for 1.6 release, we need to find
+    # a solution for python 2.3.x
+    'package_dir': { 'MoinMoin.i18n': 'MoinMoin/i18n', },
+    'package_data': { 'MoinMoin.i18n': ['README', 'Makefile', 'MoinMoin.pot', 'POTFILES.in',
+                                        '*.po',
+                                        'mo/*',
+                                        'tools/*',], },
+
     # Override certain command classes with our own ones
     'cmdclass': {
         'build_scripts': build_scripts_moin,