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

move {ARTICLE,PAGE}_DIR -> {ARTICLE,PAGE}_PATHS and correlate with {ARTICLE,PAGE}_EXCLUDES #1322

Merged
merged 3 commits into from
Jun 25, 2014

Conversation

smartass101
Copy link
Contributor

Instead of one path a list can be given. This due to popular request.
Should help people not wanting to use Pelican for blogging.

@smartass101
Copy link
Contributor Author

I get some weird errors with these tests:

======================================================================
ERROR: test_custom_generation_works (pelican.tests.test_pelican.TestPelican)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/tests/test_pelican.py", line 102, in test_custom_generation_works
    mute(True)(pelican.run)()
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/tests/support.py", line 102, in wrapper
    out = func(*args, **kwargs)
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/__init__.py", line 167, in run
    p.generate_context()
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/generators.py", line 664, in generate_context
    static_path, extensions=False):
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/generators.py", line 126, in get_files
    for dirpath, dirs, temp_files in os.walk(root, followlinks=True):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 294, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 294, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 294, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 294, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 284, in walk
    if isdir(join(top, name)):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/posixpath.py", line 80, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0x91 in position 19: ordinal not in range(128)

======================================================================
ERROR: test_theme_static_paths_copy (pelican.tests.test_pelican.TestPelican)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/tests/test_pelican.py", line 116, in test_theme_static_paths_copy
    mute(True)(pelican.run)()
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/tests/support.py", line 102, in wrapper
    out = func(*args, **kwargs)
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/__init__.py", line 167, in run
    p.generate_context()
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/generators.py", line 664, in generate_context
    static_path, extensions=False):
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/generators.py", line 126, in get_files
    for dirpath, dirs, temp_files in os.walk(root, followlinks=True):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 294, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 294, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 294, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 294, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 284, in walk
    if isdir(join(top, name)):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/posixpath.py", line 80, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0x91 in position 19: ordinal not in range(128)

======================================================================
ERROR: test_theme_static_paths_copy_single_file (pelican.tests.test_pelican.TestPelican)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/tests/test_pelican.py", line 136, in test_theme_static_paths_copy_single_file
    mute(True)(pelican.run)()
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/tests/support.py", line 102, in wrapper
    out = func(*args, **kwargs)
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/__init__.py", line 167, in run
    p.generate_context()
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/generators.py", line 664, in generate_context
    static_path, extensions=False):
  File "/home/ondrej/projects/pelican/repos/pelican/pelican/generators.py", line 126, in get_files
    for dirpath, dirs, temp_files in os.walk(root, followlinks=True):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 294, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 294, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 294, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 294, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/os.py", line 284, in walk
    if isdir(join(top, name)):
  File "/home/ondrej/projects/pelican/repos/pelican/.tox/py27/lib64/python2.7/posixpath.py", line 80, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0x91 in position 19: ordinal not in range(128)

Not sure what to make of it. When I test this PR on my normal site, it works fine.

@@ -462,7 +463,7 @@ def generate_context(self):
all_articles = []
all_drafts = []
for f in self.get_files(
self.settings['ARTICLE_DIR'],
Copy link
Member

Choose a reason for hiding this comment

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

We should still support ARTICLE_DIR and deprecate it instead of removing it so soon. So we don't break peoples config without deprecating the settings.

ARTICLE_DIR should be added to ARTICLE_PATHS for now.

@smartass101
Copy link
Contributor Author

Thank you @kylef for reminding me, added some backward compatibility code.

@justinmayer
Copy link
Member

Running the tests on this PR on my development environment (Mac OS X 10.9.2) results in a hung state — the tests never complete. Any updates on this effort, Ondrej?

@smartass101
Copy link
Contributor Author

I still have no idea what is wrong, it seemed simple enough.

ingwinlu added a commit to ingwinlu/pelican that referenced this pull request May 5, 2014
@ingwinlu ingwinlu mentioned this pull request May 5, 2014
ingwinlu pushed a commit to ingwinlu/pelican that referenced this pull request May 6, 2014
Instead of one path a list can be given. This is due to popular request.
Should help people not wanting to use Pelican for blogging.
Maintain backward compatibility though.

fix for getpelican#1322
ingwinlu added a commit to ingwinlu/pelican that referenced this pull request May 6, 2014
ingwinlu added a commit to ingwinlu/pelican that referenced this pull request May 6, 2014
if user still uses old path format, this will wrap the string into a list an process normally
ingwinlu added a commit to ingwinlu/pelican that referenced this pull request May 6, 2014
if old path settings is used, it gets wrapped into a list and processed normally
@ingwinlu ingwinlu mentioned this pull request May 6, 2014
ingwinlu added a commit to ingwinlu/pelican that referenced this pull request May 6, 2014
if old path settings is used, it gets wrapped into a list and processed normally
ingwinlu added a commit to ingwinlu/pelican that referenced this pull request May 6, 2014
change how STATIC_PATHS get processed to work with the new get_files function
@smartass101
Copy link
Contributor Author

Thanks to @ingwinlu's efforts in #1340 and #1341 I was able to fix the problem in StaticGenerator. This can now be merged. Is there an issue for PLUGIN_PATH -> PLUGIN_PATHS somewhere?

@justinmayer
Copy link
Member

@smartass101: We do now — see #1344.

@smartass101 smartass101 changed the title move {ARTICLE,PAGE}_DIR -> {ARTICLE,PAGE}_PATHS move {ARTICLE,PAGE}_DIR -> {ARTICLE,PAGE}_PATHS and correlate with {ARTICLE,PAGE}_EXCLUDES May 13, 2014
@smartass101 smartass101 added this to the 3.4 milestone May 13, 2014
@smartass101
Copy link
Contributor Author

As discussed on https://botbot.me/freenode/pelican/msg/14590798/ , as part of this unification with other *_PATHS settings (like #1344) we will make Pelican automatically add PAGE_PATHS to ARTICLE_EXCLUDES which simplifies stuff for users.

Instead of one path a list can be given. This is due to popular request.
Should help people not wanting to use Pelican for blogging.
Maintain backward compatibility though.
Thanks to @ingwinlu for pointing out the change in StaticGenerator.
Pelican uses *_PATHS names for settings that represent a list of paths.
This makes it easier for someone to change PAGE_PATHS without the
need to change ARTICLE_EXCLUDES accordingly.
@justinmayer
Copy link
Member

Great work, Ondrej. One minor thing to correct, methinks:

WARNING: PLUGIN_PATH setting has been replaced by PLUGIN_PATHS, moving it to the new setting name.
WARNING: Defining PLUGIN_PATHS setting as string has been deprecated (should be a list)

I believe you added the first warning, which should be kept, while the (now-redundant) second warning was part of the initial implementation by @nikhilkalige.

@justinmayer
Copy link
Member

As per discussion on IRC, @smartass101 mentioned that both warnings have their value and should remain.

Thanks for all your work on this, Ondrej!

justinmayer added a commit that referenced this pull request Jun 25, 2014
move {ARTICLE,PAGE}_DIR -> {ARTICLE,PAGE}_PATHS and correlate with {ARTICLE,PAGE}_EXCLUDES
@justinmayer justinmayer merged commit 2432a22 into getpelican:master Jun 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants