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

Fix #2504 -- add nikola theme --list-installed #2512

Merged
merged 2 commits into from
Sep 25, 2016
Merged

Conversation

Kwpolska
Copy link
Member

This is #2504.

cc @ralsina, @stefanos82.

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
themes = []
themes_dirs = self.site.themes_dirs + [resource_filename('nikola', os.path.join('data', 'themes'))]
for tdir in themes_dirs:
themes += [(i, os.path.join(tdir, i)) for i in os.listdir(tdir)]
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't you filter themes by isdir() just in case there is some random file in themes/ or similar?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
Copy link
Member

@ralsina ralsina left a comment

Choose a reason for hiding this comment

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

+1 fixes the only propblem I saw there.

@Kwpolska Kwpolska merged commit 7b71ced into master Sep 25, 2016
@Kwpolska Kwpolska deleted the list-installed-themes branch September 25, 2016 15:38
@stefanos82
Copy link

That's very helpful and so nice of you @Kwpolska and @ralsina for implementing this in such a short period of time.

Another kind suggestion: can we do something about preventing a user from even attempting to install bootstrap3 or other default templates that come pre-configured with Nikola installation?

Even though it throws an error, it should have prevented me from attempting to do so by simply invalidating the theme name.

nikola theme --install=bootstrap3
[2016-09-25T18:35:12Z] INFO: requests.packages.urllib3.connectionpool: Starting new HTTPS connection (1): themes.getnikola.com
[2016-09-25T18:35:18Z] ERROR: theme: Theme 'bootstrap3' is already installed in /home/stefanos/.virtualenvs/mynewenv/lib/python3.5/site-packages/nikola/data/themes/bootstrap3

@Kwpolska
Copy link
Member Author

The theme doesn’t get overwritten (in fact, you can’t download base and bootstrap3 from the site). We could check the built-in theme list if we really cared, but this is good enough IMO.

@stefanos82
Copy link

That should do too, no worries.

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

Successfully merging this pull request may close these issues.

None yet

3 participants