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

Exception: raise TypeError(f'{funcname}() argument must be str, bytes, or ; due to mistake in ABLog config handling with multiple langua #137

Closed
AlbertMietus opened this issue May 11, 2022 · 2 comments · Fixed by #142

Comments

@AlbertMietus
Copy link

AlbertMietus commented May 11, 2022

When Sphinx/ABlog is configured with multiple languages, like

blog_languages = {
    'nl'  : ('Nederlands', None),
    'en'  : ('English', None)
}

post.generate_atom_feeds() on line 684 goes (or can go) wrong

if len(blog.blog_languages) > 1:
        base_url = os_path_join(url, app.config.language)

When that unrelated [app.config] language setting is not set (default), it's None. Which is a not allowed parameter in os-join-path (in generi Path; that is ultimately called).

To Reproduce

Create a setting with 2 (or more) blog_languages, as shown above. The related setting blog_default_language is a relevant. And enable atom-feed (default)

Then it goes wrong.

Remove that setting, or when it dict has length=1. It work

Fix (suggestions)

  • Check the value of app.config.language; when none, do not use
  • Use the value of blog_default_language (when not none)
  • When no default is available, use the first key (or any) of the blog.blog_languages dict.

note: When that dict has no entries, the issue does not arise

@SilverRainZ
Copy link
Contributor

May be related to #136.

@nabobalis
Copy link
Contributor

nabobalis commented Jul 9, 2022

I thought I would try to fix this in #142
Changing to make sure that join() never gets a None value was simple enough but as far as I can see, the url should never have the language set in the URL. So I removed that block of code instead.

It should be in the next release of ablog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants