Skip to content
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

Refactor scanposts (Issue #1700) #1708

Merged
merged 24 commits into from May 22, 2015
Merged

Refactor scanposts (Issue #1700) #1708

merged 24 commits into from May 22, 2015

Conversation

@ralsina
Copy link
Member

ralsina commented May 9, 2015

See Issue #1700 for details.

This branch should not cause any visible change in behaviour :-)

ralsina and others added 4 commits May 8, 2015
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
"""Scan all the posts."""
if self._scanned and not really:
# FIXME this is temporary while moving things out to a plugin
# Why doesn't getPluginByName work????

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska May 9, 2015

Member

How are you calling it? This will work:

site.plugin_manager.getPluginByName('scan_posts', 'PostScanner')

(also, PostScanner was not added as a category; fixed in 2f7dd8f)

This comment has been minimized.

Copy link
@ralsina

ralsina May 9, 2015

Author Member

Let's add a "rescan_posts" method that clears _scanned and calls scan_posts instead.

@@ -1352,129 +1352,14 @@ def flatten(task):
'task_dep': task_dep
}

def scan_posts(self, really=False, ignore_quit=False, quiet=False):

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska May 9, 2015

Member

The parameters are useful (for example, coil depends on really) — you should leave them in and make them usable in the plugin.

ralsina added 3 commits May 9, 2015
@ralsina ralsina changed the title WIP Refactor scanposts (Issue #1700) Refactor scanposts (Issue #1700) May 9, 2015
ralsina added 7 commits May 9, 2015
"""Creates a list of posts from some source. Returns timeline, global_data:
timeline is a list of Post objects
global_data is a dictionary where keys are source paths and values are posts.

This comment has been minimized.

Copy link
@felixfontein

felixfontein May 9, 2015

Contributor

Is global_data still in use? It seems that neither the scan_posts plugin uses it, nor does Nikola.scan_posts expects it.

This comment has been minimized.

Copy link
@ralsina

ralsina May 10, 2015

Author Member

I had deleted it, forgot to fix the docstrings

ralsina added 5 commits May 10, 2015
@ralsina
Copy link
Member Author

ralsina commented May 19, 2015

@felixfontein looks like merging the hierarchical tags broke this branch... can you give me a hand and see what it is?

I get

Traceback (most recent call last):
  File "/home/ralsina/.virtualenvs/nikola/local/lib/python2.7/site-packages/doit-0.28.0-py2.7.egg/doit/doit_cmd.py", line 165, in run
    return command.parse_execute(args)
  File "/home/ralsina/.virtualenvs/nikola/local/lib/python2.7/site-packages/doit-0.28.0-py2.7.egg/doit/cmd_base.py", line 122, in parse_execute
    return self.execute(params, args)
  File "/home/ralsina/.virtualenvs/nikola/local/lib/python2.7/site-packages/doit-0.28.0-py2.7.egg/doit/cmd_base.py", line 380, in execute
    self, params, args)
  File "/home/ralsina/Desktop/proyectos/nikola/master/nikola/__main__.py", line 258, in load_tasks
    self.nikola.gen_tasks('render_site', "Task", 'Group of tasks to render the site.'))
  File "/home/ralsina/.virtualenvs/nikola/local/lib/python2.7/site-packages/doit-0.28.0-py2.7.egg/doit/loader.py", line 296, in generate_tasks
    for task_dict, x_doc in flat_generator(gen_result, gen_doc):
  File "/home/ralsina/.virtualenvs/nikola/local/lib/python2.7/site-packages/doit-0.28.0-py2.7.egg/doit/loader.py", line 28, in flat_generator
    for item in gen:
  File "/home/ralsina/Desktop/proyectos/nikola/master/nikola/nikola.py", line 1338, in gen_tasks
    for task in flatten(pluginInfo.plugin_object.gen_tasks()):
  File "/home/ralsina/Desktop/proyectos/nikola/master/nikola/nikola.py", line 1332, in flatten
    for t in task:
  File "/home/ralsina/Desktop/proyectos/nikola/master/nikola/plugins/task/tags.py", line 98, in gen_tasks
    cats = {tuple(self.slugify_category_name(category)): category for category in self.site.posts_per_category.keys()}
  File "/home/ralsina/Desktop/proyectos/nikola/master/nikola/plugins/task/tags.py", line 98, in <dictcomp>
    cats = {tuple(self.slugify_category_name(category)): category for category in self.site.posts_per_category.keys()}
  File "/home/ralsina/Desktop/proyectos/nikola/master/nikola/plugins/task/tags.py", line 400, in slugify_category_name
    result[0] = self.site.config['CATEGORY_PREFIX'] + result[0]
IndexError: list index out of range
@felixfontein
Copy link
Contributor

felixfontein commented May 20, 2015

While merging, you reverted one change done in the category_hierarchy branch. I re-added that change, and now it should work :-)

ralsina added 2 commits May 20, 2015
ralsina added a commit that referenced this pull request May 22, 2015
Refactor scanposts (Issue #1700)
@ralsina ralsina merged commit 6bc0dd4 into master May 22, 2015
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/appveyor Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@ralsina ralsina deleted the refactor-scanposts branch May 22, 2015
@Kwpolska
Copy link
Member

Kwpolska commented May 22, 2015

I thought we were supposed to have a v7.5.0?

@ralsina
Copy link
Member Author

ralsina commented May 22, 2015

Sure, we will. This is not backwards-incompatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Version 8
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.