Skip to content

Commit 07b299c

Browse files
author
Ask Solem
committed
Some more minor django references removed
1 parent 872620c commit 07b299c

File tree

15 files changed

+17
-160
lines changed

15 files changed

+17
-160
lines changed

celery/backends/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def get_backend_cls(backend):
2626
"""
2727
.. function:: get_default_backend_cls()
2828
29-
Get the backend class specified in :setting:`CELERY_RESULT_BACKEND`.
29+
Get the backend class specified in the ``CELERY_RESULT_BACKEND`` setting.
3030
3131
"""
3232
get_default_backend_cls = curry(get_backend_cls, conf.RESULT_BACKEND)
@@ -36,7 +36,7 @@ def get_backend_cls(backend):
3636
.. class:: DefaultBackend
3737
3838
The default backend class used for storing task results and status,
39-
specified in :setting:`CELERY_RESULT_BACKEND`.
39+
specified in the ``CELERY_RESULT_BACKEND`` setting.
4040
4141
"""
4242
DefaultBackend = get_default_backend_cls()

celery/backends/pyredis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class RedisBackend(KeyValueStoreBackend):
2525
The port to the Redis server.
2626
2727
Raises :class:`celery.exceptions.ImproperlyConfigured` if
28-
:setting:`REDIS_HOST` or :setting:`REDIS_PORT` is not set.
28+
the ``REDIS_HOST`` or ``REDIS_PORT`` settings is not set.
2929
3030
"""
3131
redis_host = "localhost"

celery/db/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from sqlalchemy import Column, Sequence, ForeignKey
44
from sqlalchemy import Integer, String, Text, DateTime, PickleType
55
from sqlalchemy.orm import relation
6-
from sqlalchemy.ext.declarative import declarative_base
76

87
from celery import states
98
from celery.db.session import ResultModelBase

celery/loaders/default.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from importlib import import_module
23

34
from celery.loaders.base import BaseLoader
45

@@ -10,6 +11,7 @@
1011
"DATABASE_ENGINE": "sqlite3",
1112
"DATABASE_NAME": "celery.sqlite",
1213
"INSTALLED_APPS": ("celery", ),
14+
"CELERY_IMPORTS": (),
1315
}
1416

1517

@@ -49,7 +51,7 @@ def read_configuration(self):
4951
celery and Django so it can be used by regular Python."""
5052
configname = os.environ.get("CELERY_CONFIG_MODULE",
5153
DEFAULT_CONFIG_MODULE)
52-
celeryconfig = __import__(configname, {}, {}, [''])
54+
celeryconfig = import_module(configname)
5355
usercfg = dict((key, getattr(celeryconfig, key))
5456
for key in dir(celeryconfig)
5557
if wanted_module_item(key))

celery/tests/test_loaders.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,6 @@ def test_import_default_modules(self):
6060
[os, sys, task])
6161

6262

63-
def modifies_django_env(fun):
64-
65-
def _protected(*args, **kwargs):
66-
from django.conf import settings
67-
current = dict((key, getattr(settings, key))
68-
for key in settings.get_all_members()
69-
if key.isupper())
70-
try:
71-
return fun(*args, **kwargs)
72-
finally:
73-
for key, value in current.items():
74-
setattr(settings, key, value)
75-
76-
return _protected
77-
78-
7963
class TestDefaultLoader(unittest.TestCase):
8064

8165
def test_wanted_module_item(self):
@@ -84,7 +68,6 @@ def test_wanted_module_item(self):
8468
self.assertFalse(default.wanted_module_item("_foo"))
8569
self.assertFalse(default.wanted_module_item("__foo"))
8670

87-
@modifies_django_env
8871
def test_read_configuration(self):
8972
from types import ModuleType
9073

@@ -93,17 +76,16 @@ class ConfigModule(ModuleType):
9376

9477
celeryconfig = ConfigModule("celeryconfig")
9578
celeryconfig.CELERY_IMPORTS = ("os", "sys")
79+
configname = os.environ.get("CELERY_CONFIG_MODULE") or "celeryconfig"
9680

97-
sys.modules["celeryconfig"] = celeryconfig
81+
prevconfig = sys.modules[configname]
82+
sys.modules[configname] = celeryconfig
9883
try:
9984
l = default.Loader()
10085
settings = l.read_configuration()
10186
self.assertTupleEqual(settings.CELERY_IMPORTS, ("os", "sys"))
102-
from django.conf import settings
103-
settings.configured = False
10487
settings = l.read_configuration()
10588
self.assertTupleEqual(settings.CELERY_IMPORTS, ("os", "sys"))
106-
self.assertTrue(settings.configured)
10789
l.on_worker_init()
10890
finally:
109-
sys.modules.pop("celeryconfig", None)
91+
sys.modules[configname] = prevconfig

docs/_ext/djangodocs.py

Lines changed: 0 additions & 112 deletions
This file was deleted.

docs/conf.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,13 @@
66
# If your extensions are in another directory, add it here. If the directory
77
# is relative to the documentation root, use os.path.abspath to make it
88
# absolute, like shown here.
9-
sys.path.append("../celery")
10-
sys.path.append("../tests")
11-
import settings
12-
from django.core.management import setup_environ
13-
from django.conf import settings as dsettings
14-
setup_environ(settings)
15-
dsettings.configure()
9+
sys.path.append(os.path.join(os.pardir, "tests"))
1610
import celery
17-
sys.path.append(os.path.join(os.path.dirname(__file__), "_ext"))
1811

1912
# General configuration
2013
# ---------------------
2114

22-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage', 'djangodocs']
15+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage']
2316

2417
# Add any paths that contain templates here, relative to this directory.
2518
templates_path = ['.templates']

docs/reference/celery.conf.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ Configuration - celery.conf
230230
.. data:: CELERYD_POOL
231231

232232
Name of the task pool class used by the worker.
233-
Default is ``"celery.worker.pool.TaskPool"`.
233+
Default is ``"celery.worker.pool.TaskPool"``.
234234

235235
.. data:: CELERYD_LISTENER
236236

docs/reference/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,4 @@
3030
celery.events
3131
celery.bin.celeryd
3232
celery.bin.celerybeat
33-
celery.bin.celeryinit
3433
celery.bin.camqadm

examples/README.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77

88
Example Python project using celery.
99

10-
* django
11-
12-
Example Django project using celery.
13-
1410
* httpexample
1511

1612
Example project using remote tasks (webhook tasks)

0 commit comments

Comments
 (0)