Skip to content

Fixes close method call when imp returns None in loaders #502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions djcelery/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def get_actions(self, request):
actions.pop('delete_selected', None)
return actions


admin.site.register(TaskState, TaskMonitor)
admin.site.register(WorkerState, WorkerMonitor)

Expand Down
3 changes: 2 additions & 1 deletion djcelery/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ def find_related_module(app, related_name):

try:
f, _, _ = imp.find_module(related_name, app_path)
f.close()
# f is returned None when app_path is a module
f and f.close()
except ImportError:
return

Expand Down
2 changes: 2 additions & 0 deletions djcelery/management/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def _validate_thread_sharing(self):
patch_thread_ident.called = True
except ImportError:
pass


patch_thread_ident()


Expand Down
1 change: 1 addition & 0 deletions djcelery/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def schedule(self):
if self.crontab:
return self.crontab.schedule


signals.pre_delete.connect(PeriodicTasks.changed, sender=PeriodicTask)
signals.pre_save.connect(PeriodicTasks.changed, sender=PeriodicTask)

Expand Down
1 change: 1 addition & 0 deletions djcelery/mon.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ def main(argv=sys.argv):
management.call_command('migrate')
run_monitor(argv)


if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions djcelery/picklefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def get_db_prep_lookup(self, lookup_type, value, *args, **kwargs):
return super(PickledObjectField, self) \
.get_db_prep_lookup(*args, **kwargs)


try:
from south.modelsinspector import add_introspection_rules
except ImportError:
Expand Down
1 change: 1 addition & 0 deletions djcelery/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
class MockRequest(object):
pass


request = MockRequest()

site = admin.AdminSite()
Expand Down
2 changes: 2 additions & 0 deletions djcelery/tests/test_worker_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def mytask(i):
def get_db_connection(i):
from django.db import connection
return id(connection)


get_db_connection.ignore_result = True


Expand Down