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 ralsina commented May 9, 2015

See Issue #1700 for details.

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

"""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????
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ralsina ralsina changed the title WIP Refactor scanposts (Issue #1700) Refactor scanposts (Issue #1700) 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had deleted it, forgot to fix the docstrings

@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

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

ralsina added a commit that referenced this pull request May 22, 2015
@ralsina ralsina merged commit 6bc0dd4 into master May 22, 2015
@ralsina ralsina deleted the refactor-scanposts branch May 22, 2015 16:57
@Kwpolska
Copy link
Member

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
Labels
None yet
Projects
No open projects
Version 8
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants