Permalink
Browse files

tests are fixed

  • Loading branch information...
1 parent f65ffef commit 14c29421519afa36ecd48e4283c62123872d834f @Fantomas42 committed Sep 25, 2011
View
@@ -8,6 +8,8 @@
'NAME': os.path.join(os.path.dirname(__file__), 'demo.db')}
}
+STATIC_URL = '/static/'
+
MEDIA_URL = 'http://localhost:8000/'
SECRET_KEY = 'jo-1rzm(%sf)3#n+fb7h955yu$3(pt63abhi12_t7e^^5q8dyw'
@@ -54,7 +56,6 @@
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.contrib.messages.context_processors.messages',
- 'zinnia.context_processors.media',
'zinnia.context_processors.version',
)
View
@@ -1,19 +1,18 @@
"""Views for the Zinnia Demo"""
+from django.conf import settings
from django.template import loader
from django.template import Context
from django.http import HttpResponseServerError
-from zinnia.settings import MEDIA_URL
-
def server_error(request, template_name='500.html'):
"""
500 error handler.
Templates: `500.html`
Context:
- MEDIA_URL
+ STATIC_URL
Path of static media (e.g. "media.example.org")
"""
t = loader.get_template(template_name)
return HttpResponseServerError(
- t.render(Context({'ZINNIA_MEDIA_URL': MEDIA_URL})))
+ t.render(Context({'STATIC_URL': settings.STATIC_URL})))
View
@@ -8,6 +8,7 @@
from django.utils.text import truncate_words
from django.conf.urls.defaults import url
from django.conf.urls.defaults import patterns
+from django.conf import settings as project_settings
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse, NoReverseMatch
@@ -308,33 +309,33 @@ def get_urls(self):
return urls + entry_admin_urls
def _media(self):
- MEDIA_URL = settings.MEDIA_URL
+ STATIC_URL = project_settings.STATIC_URL
media = super(EntryAdmin, self).media + Media(
- css={'all': ('%scss/jquery.autocomplete.css' % MEDIA_URL,)},
- js=('%sjs/jquery.js' % MEDIA_URL,
- '%sjs/jquery.bgiframe.js' % MEDIA_URL,
- '%sjs/jquery.autocomplete.js' % MEDIA_URL,
+ css={'all': ('%scss/jquery.autocomplete.css' % STATIC_URL,)},
+ js=('%sjs/jquery.js' % STATIC_URL,
+ '%sjs/jquery.bgiframe.js' % STATIC_URL,
+ '%sjs/jquery.autocomplete.js' % STATIC_URL,
reverse('admin:zinnia_entry_autocomplete_tags'),))
if settings.WYSIWYG == 'wymeditor':
media += Media(
- js=('%sjs/wymeditor/jquery.wymeditor.pack.js' % MEDIA_URL,
+ js=('%sjs/wymeditor/jquery.wymeditor.pack.js' % STATIC_URL,
'%sjs/wymeditor/plugins/hovertools/'
- 'jquery.wymeditor.hovertools.js' % MEDIA_URL,
+ 'jquery.wymeditor.hovertools.js' % STATIC_URL,
reverse('admin:zinnia_entry_wymeditor')))
elif settings.WYSIWYG == 'tinymce':
from tinymce.widgets import TinyMCE
media += TinyMCE().media + Media(
js=(reverse('tinymce-js', args=('admin/zinnia/entry',)),))
elif settings.WYSIWYG == 'markitup':
media += Media(
- js=('%sjs/markitup/jquery.markitup.js' % MEDIA_URL,
+ js=('%sjs/markitup/jquery.markitup.js' % STATIC_URL,
'%sjs/markitup/sets/%s/set.js' % (
- MEDIA_URL, settings.MARKUP_LANGUAGE),
+ STATIC_URL, settings.MARKUP_LANGUAGE),
reverse('admin:zinnia_entry_markitup')),
css={'all': (
- '%sjs/markitup/skins/django/style.css' % MEDIA_URL,
+ '%sjs/markitup/skins/django/style.css' % STATIC_URL,
'%sjs/markitup/sets/%s/style.css' % (
- MEDIA_URL, settings.MARKUP_LANGUAGE))})
+ STATIC_URL, settings.MARKUP_LANGUAGE))})
return media
media = property(_media)
View
@@ -9,8 +9,6 @@
from django.utils.encoding import smart_unicode
from django.utils.encoding import force_unicode
-from zinnia.settings import MEDIA_URL
-
class TreeNodeChoiceField(forms.ModelChoiceField):
"""Duplicating the TreeNodeChoiceField bundled in django-mptt
@@ -105,5 +103,5 @@ def render_option(option_value, option_label, sort_fields):
class Media:
"""MPTTFilteredSelectMultiple's Media"""
js = (settings.ADMIN_MEDIA_PREFIX + 'js/core.js',
- MEDIA_URL + 'js/mptt_m2m_selectbox.js',
+ settings.STATIC_URL + 'zinnia/js/mptt_m2m_selectbox.js',
settings.ADMIN_MEDIA_PREFIX + 'js/SelectFilter2.js',)
@@ -1,6 +1,7 @@
"""Context Processors for Zinnia"""
from zinnia import __version__
+
def version(request):
"""Adds version of Zinnia to the context"""
return {'ZINNIA_VERSION': __version__}
@@ -1,6 +1,7 @@
"""Plugins for CMS"""
import itertools
+from django.conf import settings
from django.utils.translation import ugettext as _
from tagging.models import TaggedItem
@@ -13,7 +14,6 @@
from zinnia.plugins.models import RandomEntriesPlugin
from zinnia.plugins.models import LatestEntriesPlugin
from zinnia.plugins.models import SelectedEntriesPlugin
-from zinnia.settings import MEDIA_URL
class CMSLatestEntriesPlugin(CMSPluginBase):
@@ -84,7 +84,7 @@ def render(self, context, instance, placeholder):
def icon_src(self, instance):
"""Icon source of the plugin"""
- return MEDIA_URL + u'img/plugin.png'
+ return settings.STATIC_URL + u'zinnia/img/plugin.png'
class CMSSelectedEntriesPlugin(CMSPluginBase):
@@ -106,7 +106,7 @@ def render(self, context, instance, placeholder):
def icon_src(self, instance):
"""Icon source of the plugin"""
- return MEDIA_URL + u'img/plugin.png'
+ return settings.STATIC_URL + u'zinnia/img/plugin.png'
class CMSRandomEntriesPlugin(CMSPluginBase):
@@ -128,7 +128,7 @@ def render(self, context, instance, placeholder):
def icon_src(self, instance):
"""Icon source of the plugin"""
- return MEDIA_URL + u'img/plugin.png'
+ return settings.STATIC_URL + u'zinnia/img/plugin.png'
plugin_pool.register_plugin(CMSLatestEntriesPlugin)
plugin_pool.register_plugin(CMSSelectedEntriesPlugin)
View
@@ -1,5 +1,4 @@
"""Settings of Zinnia"""
-import os
from django.conf import settings
PING_DIRECTORIES = getattr(settings, 'ZINNIA_PING_DIRECTORIES',
View
@@ -7,11 +7,12 @@
SITE_ID = 1
+STATIC_URL = '/static/'
+
ROOT_URLCONF = 'zinnia.tests.urls'
TEMPLATE_CONTEXT_PROCESSORS = [
'django.core.context_processors.request',
- 'zinnia.context_processors.media',
'zinnia.context_processors.version']
TEMPLATE_DIRS = [os.path.join(os.path.dirname(__file__),

0 comments on commit 14c2942

Please sign in to comment.