changeset 1966:46e8aa18c4d1 namespaces

merged default branch into namespaces branch
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 10 Feb 2013 17:25:10 +0100
parents 5d672f909f27 (current diff) 7fe3283f9eeb (diff)
children 2a61ee6e35a5
files MoinMoin/apps/frontend/views.py MoinMoin/items/__init__.py MoinMoin/storage/middleware/serialization.py contrib/serialized/items.moin
diffstat 5 files changed, 23 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/_tests/test_frontend.py	Sat Feb 09 17:30:19 2013 +0100
+++ b/MoinMoin/apps/frontend/_tests/test_frontend.py	Sun Feb 10 17:25:10 2013 +0100
@@ -26,14 +26,17 @@
             viewopts = {}
         if params is None:
             params = {}
-        print 'GET %s' % url_for(viewname, **viewopts)
+
         with self.app.test_client() as c:
-            rv = c.get(url_for(viewname, **viewopts), data=params)
-            assert rv.status == status
-            assert rv.headers['Content-Type'] in content_types
-            for item in data:
-                assert item in rv.data
-            return rv
+            for method in ['HEAD', 'GET']:
+                print '%s %s' % (method, url_for(viewname, **viewopts))
+                rv = c.open(url_for(viewname, **viewopts), method=method, data=params)
+                assert rv.status == status
+                assert rv.headers['Content-Type'] in content_types
+                if method == 'GET':
+                    for item in data:
+                        assert item in rv.data
+        return rv
 
     def _test_view_post(self, viewname, status='302 FOUND', content_types=('text/html; charset=utf-8', ), data=('<html>', '</html>'), form=None, viewopts=None):
         if viewopts is None:
--- a/MoinMoin/apps/frontend/views.py	Sat Feb 09 17:30:19 2013 +0100
+++ b/MoinMoin/apps/frontend/views.py	Sun Feb 10 17:25:10 2013 +0100
@@ -526,7 +526,7 @@
         abort(403)
     if isinstance(item, NonExistent):
         abort(404, item_name)
-    if request.method == 'GET':
+    if request.method in ['GET', 'HEAD']:
         form = RevertItemForm.from_defaults()
         TextCha(form).amend_form()
     elif request.method == 'POST':
@@ -552,7 +552,7 @@
         abort(403)
     if isinstance(item, NonExistent):
         abort(404, item_name)
-    if request.method == 'GET':
+    if request.method in ['GET', 'HEAD']:
         form = RenameItemForm.from_defaults()
         TextCha(form).amend_form()
         form['target'] = item.name
@@ -580,7 +580,7 @@
         abort(403)
     if isinstance(item, NonExistent):
         abort(404, item_name)
-    if request.method == 'GET':
+    if request.method in ['GET', 'HEAD']:
         form = DeleteItemForm.from_defaults()
         TextCha(form).amend_form()
     elif request.method == 'POST':
@@ -679,7 +679,7 @@
         abort(403)
     if isinstance(item, NonExistent):
         abort(404, item_name)
-    if request.method == 'GET':
+    if request.method in ['GET', 'HEAD']:
         form = DestroyItemForm.from_defaults()
         TextCha(form).amend_form()
     elif request.method == 'POST':
@@ -1067,7 +1067,7 @@
         template = 'register.html'
         FormClass = RegistrationForm
 
-    if request.method == 'GET':
+    if request.method in ['GET', 'HEAD']:
         form = FormClass.from_defaults()
         if isOpenID:
             oid = request.values.get('openid_openid')
@@ -1157,7 +1157,7 @@
     if not _using_moin_auth():
         return Response('No MoinAuth in auth list', 403)
 
-    if request.method == 'GET':
+    if request.method in ['GET', 'HEAD']:
         form = PasswordLostForm.from_defaults()
     elif request.method == 'POST':
         form = PasswordLostForm.from_flat(request.form)
@@ -1220,7 +1220,7 @@
     if not _using_moin_auth():
         return Response('No MoinAuth in auth list', 403)
 
-    if request.method == 'GET':
+    if request.method in ['GET', 'HEAD']:
         form = PasswordRecoveryForm.from_defaults()
         form.update(request.values)
     elif request.method == 'POST':
@@ -1287,7 +1287,7 @@
     if flaskg._login_multistage_name == 'openid':
         return Response(flaskg._login_multistage, mimetype='text/html')
 
-    if request.method == 'GET':
+    if request.method in ['GET', 'HEAD']:
         form = LoginForm.from_defaults()
         for authmethod in app.cfg.auth:
             hint = authmethod.login_hint()
--- a/MoinMoin/items/__init__.py	Sat Feb 09 17:30:19 2013 +0100
+++ b/MoinMoin/items/__init__.py	Sun Feb 10 17:25:10 2013 +0100
@@ -649,7 +649,7 @@
 
     def do_modify(self):
         method = request.method
-        if method == 'GET':
+        if method in ['GET', 'HEAD']:
             if isinstance(self.content, NonExistentContent):
                 return render_template('modify_select_contenttype.html',
                                        item_name=self.name,
--- a/MoinMoin/items/ticket.py	Sat Feb 09 17:30:19 2013 +0100
+++ b/MoinMoin/items/ticket.py	Sun Feb 10 17:25:10 2013 +0100
@@ -103,7 +103,7 @@
             return self.do_modify()
 
     def do_modify(self):
-        if request.method == 'GET':
+        if request.method in ['GET', 'HEAD']:
             form = TicketForm.from_item(self)
         elif request.method == 'POST':
             form = TicketForm.from_request(request)
--- a/MoinMoin/storage/middleware/serialization.py	Sat Feb 09 17:30:19 2013 +0100
+++ b/MoinMoin/storage/middleware/serialization.py	Sun Feb 10 17:25:10 2013 +0100
@@ -70,6 +70,9 @@
         if isinstance(name, unicode):
             # if we encounter single names, make a list of names:
             meta['name'] = [name, ]
+        if 'itemtype' not in meta:
+            # temporary hack to upgrade serialized item files:
+            meta['itemtype'] = u'default'
         data_size = meta[u'size']
         curr_pos = src.tell()
         limited = LimitedStream(src, data_size)