changeset 413:c85132ab35e3

Removed form code (which had been broken since it was hacked into) and the export action (which had been in a similar state). imported from: moin--main--1.5--patch-417
author Alexander Schremmer <alex@alexanderweb.de.tla>
date Fri, 03 Feb 2006 20:22:11 +0000
parents 481c432b3d11
children 6a0bfc86b441
files ChangeLog MoinMoin/Page.py MoinMoin/PageEditor.py MoinMoin/_tests/test_wikiutil.py MoinMoin/i18n/POTFILES.in MoinMoin/macro/Form.py MoinMoin/multiconfig.py MoinMoin/wikiaction.py MoinMoin/wikimacro.py MoinMoin/wikiutil.py MoinMoin/wikixml/wikiexport.py docs/CHANGES
diffstat 12 files changed, 25 insertions(+), 240 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Feb 03 20:12:31 2006 +0000
+++ b/ChangeLog	Fri Feb 03 20:22:11 2006 +0000
@@ -2,6 +2,26 @@
 # arch-tag: automatic-ChangeLog--arch@arch.thinkmo.de--2003-archives/moin--main--1.5
 #
 
+2006-02-03 21:22:11 GMT	Alexander Schremmer <alex@alexanderweb.de.tla>	patch-417
+
+    Summary:
+      Removed form code (which had been broken since it was hacked into) and the export action (which had been in a similar state).
+    Revision:
+      moin--main--1.5--patch-417
+
+
+    removed files:
+     MoinMoin/macro/.arch-ids/Form.py.id MoinMoin/macro/Form.py
+     MoinMoin/wikixml/.arch-ids/wikiexport.py.id
+     MoinMoin/wikixml/wikiexport.py
+
+    modified files:
+     ChangeLog MoinMoin/Page.py MoinMoin/PageEditor.py
+     MoinMoin/_tests/test_wikiutil.py MoinMoin/i18n/POTFILES.in
+     MoinMoin/multiconfig.py MoinMoin/wikiaction.py
+     MoinMoin/wikimacro.py MoinMoin/wikiutil.py docs/CHANGES
+
+
 2006-02-03 21:12:31 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-416
 
     Summary:
--- a/MoinMoin/Page.py	Fri Feb 03 20:12:31 2006 +0000
+++ b/MoinMoin/Page.py	Fri Feb 03 20:22:11 2006 +0000
@@ -1000,7 +1000,6 @@
         pi_formtext = []
         pi_formfields = []
         pi_lines = 0
-        wikiform = None
 
         # check for XML content
         if body and body[:5] == '<?xml':
@@ -1091,19 +1090,6 @@
                     pass
                 else:
                     request.setPragma(key, val)
-            elif verb == "form":
-                # ignore form PIs on non-form pages
-                if not wikiutil.isFormPage(request, self.page_name):
-                    continue
-
-                # collect form definitions
-                if not wikiform:
-                    from MoinMoin import wikiform
-                    # TODO: form probably can work with action=""
-                    pi_formtext.append('<table border="1" cellspacing="1" cellpadding="3">\n'
-                        '<form method="POST" action="%s">\n'
-                        '<input type="hidden" name="action" value="formtest">\n' % self.url(request))
-                pi_formtext.append(wikiform.parseDefinition(request, args, pi_formfields))
             elif verb == "acl":
                 # We could build it here, but there's no request.
                 pass
--- a/MoinMoin/PageEditor.py	Fri Feb 03 20:12:31 2006 +0000
+++ b/MoinMoin/PageEditor.py	Fri Feb 03 20:22:11 2006 +0000
@@ -835,8 +835,7 @@
         #!!! rev check is not enough since internal operations use "0"
 
         # expand variables, unless it's a template or form page
-        if not (wikiutil.isTemplatePage(self.request, self.page_name) or
-                wikiutil.isFormPage(self.request, self.page_name)):
+        if not wikiutil.isTemplatePage(self.request, self.page_name): 
             newtext = self._expand_variables(newtext)
 
         msg = ""
--- a/MoinMoin/_tests/test_wikiutil.py	Fri Feb 03 20:12:31 2006 +0000
+++ b/MoinMoin/_tests/test_wikiutil.py	Fri Feb 03 20:22:11 2006 +0000
@@ -64,33 +64,3 @@
                 '"%(name)s" is NOT a valid template name' % locals())
 
 
-class FormPageTestCase(unittest.TestCase):
-    good = (
-        'aForm',
-        'MyForm',
-    )
-    bad = (
-        'Form',
-        'AForm',
-        'FormInFront',
-        'xFormInFront',
-        'XFormInFront',
-    )
-
-    # require default page_form_regex config
-    def setUp(self):
-        self.config = TestConfig(self.request,
-                                 defaults=['page_form_regex'])
-    def tearDown(self):
-        del self.config
-
-    def testFormPage(self):
-        """wikiutil: good form names accepted, bad rejected"""
-        for name in self.good:
-            self.assert_(wikiutil.isFormPage(self.request, name),
-                '"%(name)s" is a valid form name' % locals())
-        for name in self.bad:
-            self.failIf(wikiutil.isFormPage(self.request, name),
-                '"%(name)s" is NOT a valid form name' % locals())
-
-
--- a/MoinMoin/i18n/POTFILES.in	Fri Feb 03 20:12:31 2006 +0000
+++ b/MoinMoin/i18n/POTFILES.in	Fri Feb 03 20:22:11 2006 +0000
@@ -12,7 +12,6 @@
 userform.py
 version.py
 wikiaction.py
-wikiform.py
 wikimacro.py
 wikirpc.py
 wikitest.py
--- a/MoinMoin/macro/Form.py	Fri Feb 03 20:12:31 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-"""
-    MoinMoin - Form Macro
-
-    Displays a form definition on a page, and also processes the
-    POSTed inputs.
-
-    Usage:
-        [[Form(PageDefiningTheForm)]]
-
-    TODO:
-        * Much of the code here is duplicated from Page.py (bad!)
-    
-    @copyright: 2002-2004 by Jürgen Hermann <jh@web.de>
-    @license: GNU GPL, see COPYING for details.
-"""
-
-from MoinMoin import wikiutil, wikiform
-from MoinMoin.Page import Page
-
-Dependencies = ["time"]
-
-def execute(macro, args):
-    _ = macro.request.getText
-    pagename = args
-
-    if not wikiutil.isFormPage(macro.request, pagename):
-        return (macro.formatter.sysmsg(1) +
-                macro.formatter.text('Not a form page: %s' % args) +
-                macro.formatter.sysmsg(0))
-
-    formpage = Page(macro.request, pagename)
-    body = formpage.get_raw_body()
-
-    pi_formtext = []
-    pi_formfields = []
-
-    while body and body[0] == '#':
-        # extract first line
-        try:
-            line, body = body.split('\n', 1)
-        except ValueError:
-            line = body
-            body = ''
-
-        # skip comments (lines with two hash marks)
-        if line[1] == '#': continue
-
-        # parse the PI
-        verb, args = (line[1:]+' ').split(' ', 1)
-        verb = verb.lower()
-        args = args.strip()
-
-        if verb != 'form': continue
-
-        # collect form definitions
-        if not pi_formtext:
-            pi_formtext.append('<table border="1" cellspacing="1" cellpadding="3">\n'
-                '<form method="POST" action="%s">\n'
-                '<input type="hidden" name="action" value="formtest">\n' % 'action')
-        pi_formtext.append(wikiform.parseDefinition(macro.request, args, pi_formfields))
-
-    # user-defined form preview?
-    if pi_formtext:
-        pi_formtext.append('<input type="hidden" name="fieldlist" value="%s">\n' %
-            "|".join(pi_formfields))
-        pi_formtext.append('</form></table>\n')
-
-    return macro.formatter.rawHTML(''.join(pi_formtext))
-
--- a/MoinMoin/multiconfig.py	Fri Feb 03 20:12:31 2006 +0000
+++ b/MoinMoin/multiconfig.py	Fri Feb 03 20:22:11 2006 +0000
@@ -256,7 +256,6 @@
     page_local_spelling_words = u'LocalSpellingWords'
     page_category_regex = u'^Category[A-Z]'
     page_dict_regex = u'[a-z0-9]Dict$'
-    page_form_regex = u'[a-z0-9]Form$'
     page_group_regex = u'[a-z0-9]Group$'
     page_template_regex = u'[a-z0-9]Template$'
 
@@ -519,7 +518,7 @@
         
         decode_names = (
             'sitename', 'logo_string', 'navi_bar', 'page_front_page',
-            'page_category_regex', 'page_dict_regex', 'page_form_regex',
+            'page_category_regex', 'page_dict_regex', 
             'page_group_regex', 'page_template_regex', 'page_license_page',
             'page_local_spelling_words', 'acl_rights_default',
             'acl_rights_before', 'acl_rights_after', 'mail_from'
--- a/MoinMoin/wikiaction.py	Fri Feb 03 20:12:31 2006 +0000
+++ b/MoinMoin/wikiaction.py	Fri Feb 03 20:22:11 2006 +0000
@@ -747,12 +747,7 @@
     Page(request, pagename).send_page(request)
   
 
-def do_formtest(pagename, request):
-    # test a user defined form
-    from MoinMoin import wikiform
-    wikiform.do_formtest(pagename, request)
-
-
+# Commented out by Florian Festi, cf. bug report about it
 # def do_macro(pagename, request):
 #     """ Execute a helper action within a macro.
 #     """
@@ -829,7 +824,6 @@
 def do_chart(pagename, request):
     """ Show page charts 
     
-    TODO: add support for text charts?
     """
     _ = request.getText
     if not request.user.may.read(pagename):
@@ -863,45 +857,6 @@
     raise MoinMoinNoFooter
 
 
-def do_export(pagename, request):
-    import shutil, StringIO
-    from MoinMoin.wikixml import wikiexport
-
-    # Protect this with ACLs, when ready!
-
-    # get parameters
-    compression = request.form.get('compression', None)
-
-    # prepare output stream
-    fileid = time.strftime("%Y-%m-%d", request.user.getTime(time.time()))
-    filename = "wiki-export-%s.xml" % fileid 
-    outbuff = StringIO.StringIO()
-    mimetype, out = 'text/xml', outbuff
-    if compression == "gzip":
-        import gzip
-        mimetype, out = 'application/x-gzip', gzip.GzipFile(
-            filename, "wb", 9, outbuff)
-        filename = filename + '.gz'
-
-    # create export document
-    export = wikiexport.WikiExport(out, public=1)
-    export.run()
-
-    # send http headers
-    headers = [
-        "Content-Type: %s" % mimetype,
-        "Content-Length: %d" % len(outbuff.getvalue()),
-    ]
-    if mimetype != 'text/xml':
-        headers.append("Content-Disposition: attachment; filename=%s" % filename)
-    request.http_headers(headers)
-
-    # copy the body
-    outbuff.seek(0)
-    shutil.copyfileobj(outbuff, request, 8192)
-    raise MoinMoinNoFooter
-
-
 def do_test(pagename, request):
     from MoinMoin.wikitest import runTest
     request.http_headers(["Content-type: text/plain;charset=%s" % config.charset])
@@ -938,6 +893,3 @@
         
     return handler
 
-    
- 
-
--- a/MoinMoin/wikimacro.py	Fri Feb 03 20:12:31 2006 +0000
+++ b/MoinMoin/wikimacro.py	Fri Feb 03 20:22:11 2006 +0000
@@ -583,7 +583,6 @@
 
         return result
 
-
     def _macro_GetVal(self, args):
         page,key = args.split(',')
         d = self.request.dicts.dict(page)
--- a/MoinMoin/wikiutil.py	Fri Feb 03 20:12:31 2006 +0000
+++ b/MoinMoin/wikiutil.py	Fri Feb 03 20:22:11 2006 +0000
@@ -507,8 +507,7 @@
     @return: true if page is a system page
     """
     return (request.dicts.has_member('SystemPagesGroup', pagename) or
-        isTemplatePage(request, pagename) or
-        isFormPage(request, pagename))
+        isTemplatePage(request, pagename))
 
 
 def isTemplatePage(request, pagename):
@@ -522,16 +521,6 @@
     return filter.search(pagename) is not None
 
 
-def isFormPage(request, pagename):
-    """ Is this a form page?
-    
-    @param pagename: the page name
-    @rtype: bool
-    @return: true if page is a form page
-    """
-    filter = re.compile(request.cfg.page_form_regex, re.UNICODE)
-    return filter.search(pagename) is not None
-
 def isGroupPage(request, pagename):
     """ Is this a name of group page?
 
--- a/MoinMoin/wikixml/wikiexport.py	Fri Feb 03 20:12:31 2006 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-# -*- coding: iso-8859-1 -*-
-"""
-    MoinMoin - XML Export
-
-    This module exports all data stored for a wiki.
-
-    @copyright: 2001-2004 by Jürgen Hermann <jh@web.de>
-    @license: GNU GPL, see COPYING for details.
-"""
-
-from MoinMoin import wikixml
-import MoinMoin.wikixml.util
-
-#############################################################################
-### XML Generator
-#############################################################################
-
-class ExportGenerator(wikixml.util.XMLGenerator):
-    default_xmlns = {
-        None: "http://purl.org/wiki/moin/export",
-    }
-
-    def __init__(self, out):
-        wikixml.util.XMLGenerator.__init__(self, out=out)
-
-    def startDocument(self):
-        wikixml.util.XMLGenerator.startDocument(self)
-        self.startElementNS((None, 'export'), 'export', {})
-
-    def endDocument(self):
-        self.endElementNS((None, 'export'), 'export')
-        wikixml.util.XMLGenerator.endDocument(self)
-
-
-#############################################################################
-### WikiExport class
-#############################################################################
-
-class WikiExport:
-    """ Create an XML document containing all information stored in a wiki.
-    """
-
-    def __init__(self, out, **kw):
-        """ Write wiki data to stream `out`.
-
-            Keywords:
-                public - true when this is a public export (no userdata etc.)
-        """
-        self._out = out
-        self._public = kw.get('public', 1)
-
-    def run(self):
-        """ Start the export process.
-        """
-        self.doc = ExportGenerator(self._out)
-        self.doc.startDocument()
-        # TODO: pages, users, attachments
-        self.doc.endDocument()
-
--- a/docs/CHANGES	Fri Feb 03 20:12:31 2006 +0000
+++ b/docs/CHANGES	Fri Feb 03 20:22:11 2006 +0000
@@ -11,6 +11,7 @@
     * deron meranda's formatter API cleanup
     * added div and span to formatter API
     * allow hex and symbolic entities
+    * Removed old unfinished form and export code.
 
   Fixes:
    * fixed table attribute parsing