Permalink
Browse files

sekizai & passing tests

  • Loading branch information...
1 parent c141781 commit 75182472936b056c1760a816723dc16a82638340 Jonas Obrist committed Feb 18, 2011
View
@@ -42,7 +42,13 @@ def post_patch_check():
'Please put it into your MIDDLEWARE_CLASSES in settings file')
# check sekizai namespaces
+ try:
+ from django.template.loaders.app_directories import Loader
+ except ImportError:
+ return # south...
for template in settings.CMS_TEMPLATES:
+ if template[0] == settings.CMS_TEMPLATE_INHERITANCE_MAGIC:
+ continue
if not validate_template(template[0], ['js', 'css']):
raise ImproperlyConfigured(
"All templates defined in CMS_TEMPLATES must have at least the "
@@ -394,26 +394,4 @@ def get_kwargs(self, *args, **kwargs):
kwargs['cache_result'] = True
return kwargs
register.tag(ShowUncachedPlaceholderById)
-register.tag('show_uncached_placeholder', ShowUncachedPlaceholderById)
-
-
-class PluginsMedia(RenderBlock):
- """
- This template node is used to output media for plugins.
-
- eg: {% plugins_media %}
-
- You can also pass the object a page_lookup arg if you want to output media tags for a specific
- page other than the current page.
-
- eg: {% plugins_media "gallery" %}
- """
- name = 'plugins_media'
-
- options = Options(
- parser_class=SekizaiParser,
- )
-
- def render_tag(self, context, nodelist):
- return super(PluginsMedia, self).render_tag(context, CMS_PLUGIN_MEDIA_NAMESPACE, nodelist)
-register.tag(PluginsMedia)
+register.tag('show_uncached_placeholder', ShowUncachedPlaceholderById)
View
@@ -2,25 +2,26 @@
from cms.tests.admin import AdminTestCase
from cms.tests.apphooks import ApphooksTestCase
from cms.tests.docs import DocsTestCase
+from cms.tests.forms import FormsTestCase
+from cms.tests.mail import MailTestCase
from cms.tests.menu import FixturesMenuTests, MenuTests, AdvancedSoftrootTests
+from cms.tests.middleware import MiddlewareTestCase
+from cms.tests.multilingual import MultilingualTestCase
from cms.tests.navextender import NavExtenderTestCase
from cms.tests.nonroot import NonRootCase
from cms.tests.page import PagesTestCase, NoAdminPageTests
from cms.tests.permmod import PermissionModeratorTestCase
-from cms.tests.placeholder import PlaceholderTestCase, PlaceholderActionTests
-from cms.tests.placeholder import PlaceholderModelTests
-from cms.tests.plugins import PluginManyToManyTestCase, PluginsTestCase
+from cms.tests.placeholder import (PlaceholderModelTests, PlaceholderTestCase,
+ PlaceholderActionTests)
+from cms.tests.plugins import (PluginManyToManyTestCase, PluginsTestCase,
+ SekizaiTests)
+from cms.tests.publisher import PublisherTestCase
from cms.tests.rendering import RenderingTestCase
from cms.tests.reversion_tests import ReversionTestCase
-from cms.tests.site import SiteTestCase
-from cms.tests.urlutils import UrlutilsTestCase
-from cms.tests.publisher import PublisherTestCase
-from cms.tests.multilingual import MultilingualTestCase
-from cms.tests.mail import MailTestCase
from cms.tests.settings import SettingsTests
-from cms.tests.forms import FormsTestCase
+from cms.tests.site import SiteTestCase
from cms.tests.toolbar import ToolbarTests
-from cms.tests.middleware import MiddlewareTestCase
+from cms.tests.urlutils import UrlutilsTestCase
from cms.tests.views import ViewTests
try:
from cms.tests.javascript import JavascriptTestCase
View
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import with_statement
+from cms.conf.patch import post_patch_check
from cms.exceptions import PluginAlreadyRegistered, PluginNotRegistered
from cms.models import Page, Placeholder
from cms.models.pluginmodel import CMSPlugin
@@ -8,23 +9,25 @@
from cms.plugins.file.models import File
from cms.plugins.inherit.models import InheritPagePlaceholder
from cms.plugins.text.models import Text
-from cms.plugins.text.utils import plugin_tags_to_id_list, \
- plugin_tags_to_admin_html
-from cms.test_utils.testcases import CMSTestCase, URL_CMS_PAGE, URL_CMS_PAGE_ADD, \
- URL_CMS_PLUGIN_ADD, URL_CMS_PLUGIN_EDIT, URL_CMS_PAGE_CHANGE, \
- URL_CMS_PLUGIN_REMOVE
+from cms.plugins.text.utils import (plugin_tags_to_id_list,
+ plugin_tags_to_admin_html)
+from cms.plugins.twitter.models import TwitterRecentEntries
+from cms.test_utils.testcases import (CMSTestCase, URL_CMS_PAGE, URL_CMS_PAGE_ADD,
+ URL_CMS_PLUGIN_ADD, URL_CMS_PLUGIN_EDIT, URL_CMS_PAGE_CHANGE,
+ URL_CMS_PLUGIN_REMOVE)
from cms.test_utils.util.context_managers import SettingsOverride
-
from django.conf import settings
from django.contrib.auth.models import User
from django.core.files.uploadedfile import SimpleUploadedFile
from django.forms.widgets import Media
from django.template import RequestContext
+from django.test.testcases import TestCase
from project.pluginapp.models import Article, Section
from project.pluginapp.plugins.manytomany_rel.models import ArticlePluginModel
import os
+
class DumbFixturePlugin(CMSPluginBase):
model = CMSPlugin
name = "Dumb Test Plugin. It does nothing."
@@ -300,7 +303,7 @@ def test_09_inheritplugin_media(self):
with SettingsOverride(CMS_MODERATOR=False):
inheritfrompage = self.create_page(
title='page to inherit from',
- template='media.html'
+ template='nav_playground.html'
)
body = inheritfrompage.placeholders.get(slot="body")
@@ -317,7 +320,7 @@ def test_09_inheritplugin_media(self):
page = self.create_page(
title='inherit from page',
published=True,
- template='media.html',
+ template='nav_playground.html',
)
inherited_body = page.placeholders.get(slot="body")
@@ -333,7 +336,6 @@ def test_09_inheritplugin_media(self):
self.client.logout()
response = self.client.get(page.get_absolute_url())
- print response.content
self.assertTrue('http://twitter.com/javascripts/blogger.js' in response.content)
def test_10_fileplugin_icon_uppercase(self):
@@ -607,3 +609,7 @@ def test_03_copy_plugin_with_m2m(self):
expected = [self.section_count for i in range(len(db_counts))]
self.assertEqual(expected, db_counts)
+
+class SekizaiTests(TestCase):
+ def test_post_patch_check(self):
+ post_patch_check()
View
@@ -47,11 +47,11 @@
classifiers=CLASSIFIERS,
install_requires=[
'Django>=1.2',
- 'django-classy-tags>=0.2.2',
+ 'django-classy-tags>=0.3.0',
'PIL>=1.1.6',
'south>=0.7.2',
'django-mptt>=0.4.2',
- 'django-sekizai>=0.4.0',
+ 'django-sekizai>=0.4.1',
],
packages=find_packages(exclude=["example", "example.*","testdata","testdata.*"]),
package_data={
@@ -53,6 +53,7 @@
"django.core.context_processors.media",
'django.core.context_processors.csrf',
"cms.context_processors.media",
+ "sekizai.context_processors.sekizai",
)
INTERNAL_IPS = ('127.0.0.1',)
@@ -64,7 +65,6 @@
'django.middleware.common.CommonMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
- 'cms.middleware.media.PlaceholderMediaMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
@@ -105,6 +105,7 @@
'project.fakemlng',
'south',
'reversion',
+ 'sekizai',
)
gettext = lambda s: s
@@ -1,4 +1,4 @@
-{% load i18n cms_tags menu_tags%}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+{% load i18n cms_tags menu_tags sekizai_tags %}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{ LANGUAGE_CODE }}" lang="{{ LANGUAGE_CODE }}">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
@@ -7,7 +7,7 @@
<meta name="keywords" content="{% page_attribute meta_keywords %}"/>
<link href="{{ MEDIA_URL }}css/style.css" media="all" rel="stylesheet" type="text/css" />
<link href="{{ MEDIA_URL }}css/print.css" media="print" rel="stylesheet" type="text/css" />
- {% plugins_media %}
+ {% render_block "css" %}
</head>
<body id="{% block tpl_id %}none{% endblock %}" class="{{ LANGUAGE_CODE }}">
@@ -38,5 +38,6 @@
{% block content %}{% endblock content %}
</div>
</div>
+{% render_block "js" %}
</body>
</html>
@@ -1,11 +1,11 @@
-{% load cache cms_tags menu_tags %}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+{% load cache cms_tags menu_tags sekizai_tags %}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="{{ lang }}" xml:lang="{{ lang }}" >
<head>
<title>{% page_attribute page_title %}</title>
<meta name="description" content="{% page_attribute meta_description %}"/>
<meta name="keywords" content="{% page_attribute meta_keywords %}"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
-{% plugins_media %}
+{% render_block "css" %}
<style>
.placeholder-editable {
border:1px #bbb solid;
@@ -160,5 +160,6 @@
</div>
+{% render_block "js" %}
</body>
</html>

0 comments on commit 7518247

Please sign in to comment.