Repository: learningequality/kolibri

Issue:
importchannel command is broken
## Summary

* `importchannel` command is broken

## System information

 - Version: 0.6
 - Operating system: Linux

```
kolibri manage importchannel -- network bcd99d8aeef04ce6b9e25a88d87eedb7
INFO     Downloading data for channel id bcd99d8aeef04ce6b9e25a88d87eedb7
  0%|                                             | 0/239616 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/home/christian/.virtualenvs/kolibri/bin/kolibri", line 9, in <module>
    load_entry_point('kolibri', 'console_scripts', 'kolibri')()
  File "/home/christian/repos/kolibri/kolibri/utils/cli.py", line 580, in main
    manage(command, args=django_args)
  File "/home/christian/repos/kolibri/kolibri/utils/cli.py", line 411, in manage
    execute_from_command_line(argv=argv)
  File "/home/christian/.virtualenvs/kolibri/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/home/christian/.virtualenvs/kolibri/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/christian/.virtualenvs/kolibri/local/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/christian/.virtualenvs/kolibri/local/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/home/christian/repos/kolibri/kolibri/tasks/management/commands/base.py", line 98, in handle
    return self.handle_async(*args, **options)
  File "/home/christian/repos/kolibri/kolibri/content/management/commands/importchannel.py", line 89, in handle_async
    self.download_channel(options["channel_id"])
  File "/home/christian/repos/kolibri/kolibri/content/management/commands/importchannel.py", line 42, in download_channel
    self._transfer(DOWNLOAD_METHOD, channel_id)
  File "/home/christian/repos/kolibri/kolibri/content/management/commands/importchannel.py", line 73, in _transfer
    if self.is_cancelled():
  File "/home/christian/repos/kolibri/kolibri/tasks/management/commands/base.py", line 108, in is_cancelled
    self.check_for_cancel(last_stage)
TypeError: 'NoneType' object is not callable

```

## How to reproduce

1. Use the `importchannel` command

## Real-life consequences

* Breaks my workflow.


Discussion:

Resolving patch:
diff --git a/kolibri/tasks/management/commands/base.py b/kolibri/tasks/management/commands/base.py
--- a/kolibri/tasks/management/commands/base.py
+++ b/kolibri/tasks/management/commands/base.py
@@ -104,14 +104,17 @@ def start_progress(self, total=100):
         return tracker
 
     def is_cancelled(self, last_stage="CANCELLING"):
-        try:
-            self.check_for_cancel(last_stage)
-            return False
-        except UserCancelledError:
-            return True
+        if self.check_for_cancel:
+            try:
+                self.check_for_cancel(last_stage)
+                return False
+            except UserCancelledError:
+                return True
+        return False
 
     def cancel(self, last_stage="CANCELLED"):
-        self.check_for_cancel(last_stage)
+        if self.check_for_cancel:
+            return self.check_for_cancel(last_stage)
 
     @abc.abstractmethod
     def handle_async(self, *args, **options):


Test patch: