Skip to content

Commit ee65f47

Browse files
author
shaunsephton
committed
Merge branch 'release/3.6.2'
2 parents 78f14da + 89e5117 commit ee65f47

File tree

1,105 files changed

+122948
-96205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,105 files changed

+122948
-96205
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
*.egg-info
22
*.pyc
33
*.swp
4+
.installed.cfg
5+
/bin/
6+
/develop-eggs/
7+
/eggs/
8+
/parts/
9+
/ckeditor.db

AUTHORS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ Created By
77

88
Contributors
99
------------
10+
#. `3point2 <https://github.com/3point2>`_
1011
#. `buchuki <http://github.com/buchuki>`_
1112
#. `chr15m <http://github.com/chr15m>`_
1213
#. `jeffh <https://github.com/jeffh>`_
1314
#. `loop0 <http://github.com/loop0>`_
15+
#. `mwcz <https://github.com/mwcz>`_
1416

CHANGELOG.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
Changelog
22
=========
33

4+
3.6.2
5+
-----
6+
#. Include CKEditor version 3.6.2.
7+
#. Initial work on Django aligned theme.
8+
#. Fix schema slash removal issue on media url generation. Thanks `mwcz <https://github.com/mwcz>`_
9+
#. Added compatibility for South. Thanks `3point2 <https://github.com/3point2>`_
10+
#. Prevented settings from leaking between widget instances. Thanks `3point2 <https://github.com/3point2>`_
11+
#. Fixed config_name conflict when verbose_name is used as first positional argument for a field. Thanks `3point2 <https://github.com/3point2>`_
12+
#. Refactored views to allow use of file walking with local paths. Thanks `3point2 <https://github.com/3point2>`_
13+
#. Added command to generate thumbnails. Thanks `3point2 <https://github.com/3point2>`_
14+
#. Migrated from using media to static file management.
15+
416
0.0.9
517
-----
618

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ include AUTHORS.rst
22
include LICENSE
33
include CHANGELOG.rst
44
include README.rst
5-
recursive-include ckeditor/media *
5+
recursive-include ckeditor/static *
66
recursive-include ckeditor/templates *

README.rst

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,33 @@ Provides a ``RichTextField`` and ``CKEditorWidget`` utilizing CKEditor with imag
1010
Installation
1111
------------
1212

13+
Required
14+
~~~~~~~~
1315
#. Install or add django-ckeditor to your python path.
1416

15-
#. Add ``ckeditor`` to your INSTALLED_APPS setting.
17+
#. Add ``ckeditor`` to your ``INSTALLED_APPS`` setting.
1618

17-
#. Copy the ``media/ckeditor`` directory into any directory within your media root. You can override the location in your settings (see below).
19+
#. Run the ``collectstatic`` management command: ``$ /manage.py collectstatic``. This'll copy static CKEditor require media resources into the directory given by the ``STATIC_ROOT`` setting. See `Django's documentation on managing static files <https://docs.djangoproject.com/en/dev/howto/static-files>`_ for more info.
1820

19-
#. Add a CKEDITOR_MEDIA_PREFIX setting to the project's ``settings.py`` file. This setting specifies a URL prefix to the ckeditor JS and CSS media (not uploaded media). Make sure to use a trailing slash::
20-
21-
CKEDITOR_MEDIA_PREFIX = "/media/ckeditor/"
22-
23-
#. Add a CKEDITOR_UPLOAD_PATH setting to the project's ``settings.py`` file. This setting specifies an absolute path to your ckeditor media upload directory. Make sure you have write permissions for the path, i.e.::
21+
#. Add a CKEDITOR_UPLOAD_PATH setting to the project's ``settings.py`` file. This setting specifies an absolute filesystem path to your CKEditor media upload directory. Make sure you have write permissions for the path, i.e.::
2422

2523
CKEDITOR_UPLOAD_PATH = "/home/media/media.lawrence.com/uploads"
2624

27-
#. Add ckeditor url include to the project's ``urls.py`` file::
25+
#. Add CKEditor URL include to your project's ``urls.py`` file::
2826
2927
(r'^ckeditor/', include('ckeditor.urls')),
3028

31-
#. Optionally, set the CKEDITOR_RESTRICT_BY_USER setting to ``True`` in the project's ``settings.py`` file (default ``False``). This restricts access to uploaded images to the uploading user (e.g. each user only sees and uploads their own images). Superusers can still see all images. **NOTE**: This restriction is only enforced within the CKEditor media browser.
29+
Optional
30+
~~~~~~~~
31+
#. Set the CKEDITOR_RESTRICT_BY_USER setting to ``True`` in the project's ``settings.py`` file (default ``False``). This restricts access to uploaded images to the uploading user (e.g. each user only sees and uploads their own images). Superusers can still see all images. **NOTE**: This restriction is only enforced within the CKEditor media browser.
3232

33-
#. Optionally, add a CKEDITOR_UPLOAD_PREFIX setting to the project's ``settings.py`` file. This setting specifies a URL prefix to media uploaded through ckeditor, i.e.::
33+
#. Add a CKEDITOR_UPLOAD_PREFIX setting to the project's ``settings.py`` file. This setting specifies a URL prefix to media uploaded through CKEditor, i.e.::
3434

3535
CKEDITOR_UPLOAD_PREFIX = "http://media.lawrence.com/media/ckuploads/
3636
3737
(If CKEDITOR_UPLOAD_PREFIX is not provided, the media URL will fall back to MEDIA_URL with the difference of MEDIA_ROOT and the uploaded resource's full path and filename appended.)
3838

39-
#. Optionally, add CKEDITOR_CONFIGS setting to the project's ``settings.py`` file. This specifies sets of CKEditor settings that are passed to CKEditor (see CKEditor's `Setting Configurations <http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations>`_), i.e.::
39+
#. Add a CKEDITOR_CONFIGS setting to the project's ``settings.py`` file. This specifies sets of CKEditor settings that are passed to CKEditor (see CKEditor's `Setting Configurations <http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations>`_), i.e.::
4040

4141
CKEDITOR_CONFIGS = {
4242
'awesome_ckeditor': {
@@ -96,4 +96,11 @@ Alernatively you can use the included ``CKEditorWidget`` as the widget for a for
9696
9797
admin.site.register(Post, PostAdmin)
9898

99+
Managment Commands
100+
~~~~~~~~~~~~~~~~~~
101+
Included is a management command to create thumbnails for images already contained in ``CKEDITOR_UPLOAD_PATH``. This is useful to create thumbnails when starting to use django-ckeditor with existing images. Issue the command as follows::
102+
103+
$ ./manage.py generateckeditorthumbnails
104+
99105
**NOTE**: If you're using custom views remember to include ckeditor.js in your form's media either through ``{{ form.media }}`` or through a ``<script>`` tag. Admin will do this for you automatically. See `Django's Form Media docs <http://docs.djangoproject.com/en/dev/topics/forms/media/>`_ for more info.
106+

bootstrap.py

Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
##############################################################################
2+
#
3+
# Copyright (c) 2006 Zope Foundation and Contributors.
4+
# All Rights Reserved.
5+
#
6+
# This software is subject to the provisions of the Zope Public License,
7+
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
8+
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9+
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10+
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11+
# FOR A PARTICULAR PURPOSE.
12+
#
13+
##############################################################################
14+
"""Bootstrap a buildout-based project
15+
16+
Simply run this script in a directory containing a buildout.cfg.
17+
The script accepts buildout command-line options, so you can
18+
use the -c option to specify an alternate configuration file.
19+
"""
20+
21+
import os, shutil, sys, tempfile, urllib, urllib2, subprocess
22+
from optparse import OptionParser
23+
24+
if sys.platform == 'win32':
25+
def quote(c):
26+
if ' ' in c:
27+
return '"%s"' % c # work around spawn lamosity on windows
28+
else:
29+
return c
30+
else:
31+
quote = str
32+
33+
# See zc.buildout.easy_install._has_broken_dash_S for motivation and comments.
34+
stdout, stderr = subprocess.Popen(
35+
[sys.executable, '-Sc',
36+
'try:\n'
37+
' import ConfigParser\n'
38+
'except ImportError:\n'
39+
' print 1\n'
40+
'else:\n'
41+
' print 0\n'],
42+
stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
43+
has_broken_dash_S = bool(int(stdout.strip()))
44+
45+
# In order to be more robust in the face of system Pythons, we want to
46+
# run without site-packages loaded. This is somewhat tricky, in
47+
# particular because Python 2.6's distutils imports site, so starting
48+
# with the -S flag is not sufficient. However, we'll start with that:
49+
if not has_broken_dash_S and 'site' in sys.modules:
50+
# We will restart with python -S.
51+
args = sys.argv[:]
52+
args[0:0] = [sys.executable, '-S']
53+
args = map(quote, args)
54+
os.execv(sys.executable, args)
55+
# Now we are running with -S. We'll get the clean sys.path, import site
56+
# because distutils will do it later, and then reset the path and clean
57+
# out any namespace packages from site-packages that might have been
58+
# loaded by .pth files.
59+
clean_path = sys.path[:]
60+
import site # imported because of its side effects
61+
sys.path[:] = clean_path
62+
for k, v in sys.modules.items():
63+
if k in ('setuptools', 'pkg_resources') or (
64+
hasattr(v, '__path__') and
65+
len(v.__path__) == 1 and
66+
not os.path.exists(os.path.join(v.__path__[0], '__init__.py'))):
67+
# This is a namespace package. Remove it.
68+
sys.modules.pop(k)
69+
70+
is_jython = sys.platform.startswith('java')
71+
72+
setuptools_source = 'http://peak.telecommunity.com/dist/ez_setup.py'
73+
distribute_source = 'http://python-distribute.org/distribute_setup.py'
74+
75+
76+
# parsing arguments
77+
def normalize_to_url(option, opt_str, value, parser):
78+
if value:
79+
if '://' not in value: # It doesn't smell like a URL.
80+
value = 'file://%s' % (
81+
urllib.pathname2url(
82+
os.path.abspath(os.path.expanduser(value))),)
83+
if opt_str == '--download-base' and not value.endswith('/'):
84+
# Download base needs a trailing slash to make the world happy.
85+
value += '/'
86+
else:
87+
value = None
88+
name = opt_str[2:].replace('-', '_')
89+
setattr(parser.values, name, value)
90+
91+
usage = '''\
92+
[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
93+
94+
Bootstraps a buildout-based project.
95+
96+
Simply run this script in a directory containing a buildout.cfg, using the
97+
Python that you want bin/buildout to use.
98+
99+
Note that by using --setup-source and --download-base to point to
100+
local resources, you can keep this script from going over the network.
101+
'''
102+
103+
parser = OptionParser(usage=usage)
104+
parser.add_option("-v", "--version", dest="version",
105+
help="use a specific zc.buildout version")
106+
parser.add_option("-d", "--distribute",
107+
action="store_true", dest="use_distribute", default=False,
108+
help="Use Distribute rather than Setuptools.")
109+
parser.add_option("--setup-source", action="callback", dest="setup_source",
110+
callback=normalize_to_url, nargs=1, type="string",
111+
help=("Specify a URL or file location for the setup file. "
112+
"If you use Setuptools, this will default to " +
113+
setuptools_source + "; if you use Distribute, this "
114+
"will default to " + distribute_source + "."))
115+
parser.add_option("--download-base", action="callback", dest="download_base",
116+
callback=normalize_to_url, nargs=1, type="string",
117+
help=("Specify a URL or directory for downloading "
118+
"zc.buildout and either Setuptools or Distribute. "
119+
"Defaults to PyPI."))
120+
parser.add_option("--eggs",
121+
help=("Specify a directory for storing eggs. Defaults to "
122+
"a temporary directory that is deleted when the "
123+
"bootstrap script completes."))
124+
parser.add_option("-t", "--accept-buildout-test-releases",
125+
dest='accept_buildout_test_releases',
126+
action="store_true", default=False,
127+
help=("Normally, if you do not specify a --version, the "
128+
"bootstrap script and buildout gets the newest "
129+
"*final* versions of zc.buildout and its recipes and "
130+
"extensions for you. If you use this flag, "
131+
"bootstrap and buildout will get the newest releases "
132+
"even if they are alphas or betas."))
133+
parser.add_option("-c", None, action="store", dest="config_file",
134+
help=("Specify the path to the buildout configuration "
135+
"file to be used."))
136+
137+
options, args = parser.parse_args()
138+
139+
# if -c was provided, we push it back into args for buildout's main function
140+
if options.config_file is not None:
141+
args += ['-c', options.config_file]
142+
143+
if options.eggs:
144+
eggs_dir = os.path.abspath(os.path.expanduser(options.eggs))
145+
else:
146+
eggs_dir = tempfile.mkdtemp()
147+
148+
if options.setup_source is None:
149+
if options.use_distribute:
150+
options.setup_source = distribute_source
151+
else:
152+
options.setup_source = setuptools_source
153+
154+
if options.accept_buildout_test_releases:
155+
args.append('buildout:accept-buildout-test-releases=true')
156+
args.append('bootstrap')
157+
158+
try:
159+
import pkg_resources
160+
import setuptools # A flag. Sometimes pkg_resources is installed alone.
161+
if not hasattr(pkg_resources, '_distribute'):
162+
raise ImportError
163+
except ImportError:
164+
ez_code = urllib2.urlopen(
165+
options.setup_source).read().replace('\r\n', '\n')
166+
ez = {}
167+
exec ez_code in ez
168+
setup_args = dict(to_dir=eggs_dir, download_delay=0)
169+
if options.download_base:
170+
setup_args['download_base'] = options.download_base
171+
if options.use_distribute:
172+
setup_args['no_fake'] = True
173+
ez['use_setuptools'](**setup_args)
174+
if 'pkg_resources' in sys.modules:
175+
reload(sys.modules['pkg_resources'])
176+
import pkg_resources
177+
# This does not (always?) update the default working set. We will
178+
# do it.
179+
for path in sys.path:
180+
if path not in pkg_resources.working_set.entries:
181+
pkg_resources.working_set.add_entry(path)
182+
183+
cmd = [quote(sys.executable),
184+
'-c',
185+
quote('from setuptools.command.easy_install import main; main()'),
186+
'-mqNxd',
187+
quote(eggs_dir)]
188+
189+
if not has_broken_dash_S:
190+
cmd.insert(1, '-S')
191+
192+
find_links = options.download_base
193+
if not find_links:
194+
find_links = os.environ.get('bootstrap-testing-find-links')
195+
if find_links:
196+
cmd.extend(['-f', quote(find_links)])
197+
198+
if options.use_distribute:
199+
setup_requirement = 'distribute'
200+
else:
201+
setup_requirement = 'setuptools'
202+
ws = pkg_resources.working_set
203+
setup_requirement_path = ws.find(
204+
pkg_resources.Requirement.parse(setup_requirement)).location
205+
env = dict(
206+
os.environ,
207+
PYTHONPATH=setup_requirement_path)
208+
209+
requirement = 'zc.buildout'
210+
version = options.version
211+
if version is None and not options.accept_buildout_test_releases:
212+
# Figure out the most recent final version of zc.buildout.
213+
import setuptools.package_index
214+
_final_parts = '*final-', '*final'
215+
216+
def _final_version(parsed_version):
217+
for part in parsed_version:
218+
if (part[:1] == '*') and (part not in _final_parts):
219+
return False
220+
return True
221+
index = setuptools.package_index.PackageIndex(
222+
search_path=[setup_requirement_path])
223+
if find_links:
224+
index.add_find_links((find_links,))
225+
req = pkg_resources.Requirement.parse(requirement)
226+
if index.obtain(req) is not None:
227+
best = []
228+
bestv = None
229+
for dist in index[req.project_name]:
230+
distv = dist.parsed_version
231+
if _final_version(distv):
232+
if bestv is None or distv > bestv:
233+
best = [dist]
234+
bestv = distv
235+
elif distv == bestv:
236+
best.append(dist)
237+
if best:
238+
best.sort()
239+
version = best[-1].version
240+
if version:
241+
requirement = '=='.join((requirement, version))
242+
cmd.append(requirement)
243+
244+
if is_jython:
245+
import subprocess
246+
exitcode = subprocess.Popen(cmd, env=env).wait()
247+
else: # Windows prefers this, apparently; otherwise we would prefer subprocess
248+
exitcode = os.spawnle(*([os.P_WAIT, sys.executable] + cmd + [env]))
249+
if exitcode != 0:
250+
sys.stdout.flush()
251+
sys.stderr.flush()
252+
print ("An error occurred when trying to install zc.buildout. "
253+
"Look above this message for any errors that "
254+
"were output by easy_install.")
255+
sys.exit(exitcode)
256+
257+
ws.add_entry(eggs_dir)
258+
ws.require(requirement)
259+
import zc.buildout.buildout
260+
zc.buildout.buildout.main(args)
261+
if not options.eggs: # clean up temporary egg directory
262+
shutil.rmtree(eggs_dir)

buildout.cfg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[buildout]
2+
develop=.
3+
parts=django
4+
newest=false
5+
6+
[django]
7+
recipe=djangorecipe
8+
settings=settings
9+
eggs=
10+
django-ckeditor
11+
south

ckeditor/__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@
44
from django.core.exceptions import ImproperlyConfigured
55

66
if 'ckeditor' in settings.INSTALLED_APPS:
7-
# Confirm CKEDITOR_MEDIA_PREFIX setting has been specified.
8-
try:
9-
settings.CKEDITOR_MEDIA_PREFIX
10-
except AttributeError:
11-
raise ImproperlyConfigured("django-ckeditor requires \
12-
CKEDITOR_MEDIA_PREFIX setting. This setting specifies a URL \
13-
prefix to the ckeditor JS and CSS media (not uploaded media). \
14-
Make sure to use a trailing slash: CKEDITOR_MEDIA_PREFIX = \
15-
'/media/ckeditor/'")
16-
177
# Confirm CKEDITOR_UPLOAD_PATH setting has been specified.
188
try:
199
settings.CKEDITOR_UPLOAD_PATH

0 commit comments

Comments
 (0)