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

@Kwpolska Kwpolska commented Sep 25, 2016

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)]

This comment has been minimized.

@ralsina

ralsina Sep 25, 2016
Member

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

This comment has been minimized.

@Kwpolska

Kwpolska Sep 25, 2016
Author Member

Fixed.

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

@ralsina ralsina left a comment

+1 fixes the only propblem I saw there.

@Kwpolska Kwpolska merged commit 7b71ced into master Sep 25, 2016
2 of 4 checks passed
2 of 4 checks passed
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@Kwpolska Kwpolska deleted the list-installed-themes branch Sep 25, 2016
@stefanos82
Copy link

@stefanos82 stefanos82 commented Sep 25, 2016

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

@Kwpolska Kwpolska commented Sep 25, 2016

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

@stefanos82 stefanos82 commented Sep 25, 2016

That should do too, no worries.

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

Successfully merging this pull request may close these issues.

None yet

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