Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: getnikola/nikola
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fcb6df942de9
Choose a base ref
...
head repository: getnikola/nikola
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b0c5c7e98cbe
Choose a head ref
  • 4 commits
  • 3 files changed
  • 1 contributor

Commits on Jan 21, 2015

  1. Copy the full SHA
    d70929f View commit details
  2. Copy the full SHA
    ca620dc View commit details
  3. Copy the full SHA
    17d8ef5 View commit details
  4. Fixed docstring.

    felixfontein committed Jan 21, 2015
    Copy the full SHA
    b0c5c7e View commit details
Showing with 14 additions and 11 deletions.
  1. +6 −1 nikola/nikola.py
  2. +5 −9 nikola/plugin_categories.py
  3. +3 −1 nikola/plugins/task/scan_posts.py
7 changes: 6 additions & 1 deletion nikola/nikola.py
Original file line number Diff line number Diff line change
@@ -658,13 +658,18 @@ def __init__(self, **config):
task_plugins = self._activate_plugins_of_category("BaseTask")
self.task_stages = defaultdict(list)
for plugin_info in task_plugins:
# While yapsy searches for plugins, it will also find
# the classes EarlyTask, Task and LateTask (from Nikola)
# and assume they are plugins (since they are derived from
# BaseTask as well). Since they lead to exceptions, we
# have to sort them out manually.
if type(plugin_info.plugin_object) == EarlyTask:
continue
if type(plugin_info.plugin_object) == Task:
continue
if type(plugin_info.plugin_object) == LateTask:
continue
stage = plugin_info.plugin_object.get_stage()
stage = plugin_info.plugin_object.stage
self.task_stages[stage].append(plugin_info.plugin_object)
self._activate_plugins_of_category("TaskMultiplier")

14 changes: 5 additions & 9 deletions nikola/plugin_categories.py
Original file line number Diff line number Diff line change
@@ -141,9 +141,8 @@ class BaseTask(BasePlugin):
# the others have to be specifie in the command line.
is_default = True

def get_stage(self):
"""At which level to run."""
raise NotImplementedError()
# at which stage to run
stage = 10

def gen_tasks(self):
"""Task generator."""
@@ -163,26 +162,23 @@ class EarlyTask(BaseTask):

name = "dummy_task"

def get_stage(self):
return -10
stage = -10


class Task(BaseTask):
"""Plugins of this type are task generators."""

name = "dummy_task"

def get_stage(self):
return 10
stage = 10


class LateTask(BaseTask):
"""Plugins of this type are executed after all plugins of type Task."""

name = "dummy_latetask"

def get_stage(self):
return 100
stage = 100


class TemplateSystem(BasePlugin):
4 changes: 3 additions & 1 deletion nikola/plugins/task/scan_posts.py
Original file line number Diff line number Diff line change
@@ -24,11 +24,13 @@
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from __future__ import unicode_literals

from nikola.plugin_categories import BaseTask


class ScanPosts(BaseTask):
"""Just load tasks."""
"""Just scans for posts."""

name = "scan_posts"