Author: batiste.bieler
Date: Tue Mar 3 00:40:02 2009
New Revision: 384
Modified:
trunk/example/templates/pages/nice.html
trunk/pages/admin/utils.py
trunk/pages/tests.py
Log:
Fix issue #63 and issue #68
Modified: trunk/example/templates/pages/nice.html
==============================================================================
--- trunk/example/templates/pages/nice.html (original)
+++ trunk/example/templates/pages/nice.html Tue Mar 3 00:40:02 2009
@@ -10,5 +10,6 @@
{% placeholder fancy-content with markItUpMarkdown %}
</div>
</div>
+ {% placeholder right-column with Textarea parsed as right_column %}
</div>
{% endblock %}
Modified: trunk/pages/admin/utils.py
==============================================================================
--- trunk/pages/admin/utils.py (original)
+++ trunk/pages/admin/utils.py Tue Mar 3 00:40:02 2009
@@ -32,7 +32,12 @@
"""
for node in nodelist:
if isinstance(node, PlaceholderNode):
- plist.append(node)
+ already_in_plist = False
+ for p in plist:
+ if p.name == node.name:
+ already_in_plist = True
+ if not already_in_plist:
+ plist.append(node)
node.render(Context())
for key in ('nodelist', 'nodelist_true', 'nodelist_false'):
if hasattr(node, key):
Modified: trunk/pages/tests.py
==============================================================================
--- trunk/pages/tests.py (original)
+++ trunk/pages/tests.py Tue Mar 3 00:40:02 2009
@@ -24,7 +24,7 @@
c = Client()
c.login(username= 'batiste', password='b')
response = c.get('/admin/pages/page/add/')
- assert(response.status_code == 200)
+ self.assertEqual(response.status_code, 200)
def test_02_create_page(self):
@@ -40,8 +40,8 @@
slug_content =
Content.objects.get_content_slug_by_slug(page_data['slug'])
assert(slug_content is not None)
page = slug_content.page
- assert(page.title() == page_data['title'])
- assert(page.slug() == page_data['slug'])
+ self.assertEqual(page.title(), page_data['title'])
+ self.assertEqual(page.slug(), page_data['slug'])
def test_03_slug_collision(self):
"""
@@ -248,3 +248,18 @@
self.assertEqual(Content.objects.get_content(page, 'en', 'body'), 'changed
body 2')
+ def test_09_placeholder(self):
+ """
+ Test that the placeholder is correctly displayed in
+ the admin
+ """
+ setattr(settings, "SITE_ID", 2)
+ c = Client()
+ c.login(username= 'batiste', password='b')
+ page_data = self.get_new_page_data()
+ page_data['template'] = 'pages/nice.html'
+ response = c.post('/admin/pages/page/add/', page_data)
+ response = c.get('/admin/pages/page/1/')
+ self.assertEqual(response.status_code, 200)
+
+ self.assertContains(response, 'name="right-column"', 1)
\ No newline at end of file
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---