-
Notifications
You must be signed in to change notification settings - Fork 45
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
Addition of favicon and coala logo #16
Conversation
gci/views.py
Outdated
@@ -14,6 +14,7 @@ def index(request): | |||
org_id = linked_students[0]['organization_id'] | |||
org_name = linked_students[0]['organization_name'] | |||
s = [] | |||
s.append('<image href="images/coala_logo.png">') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename this image to org_logo.png
? That'll fix the Travis build.
@andrewda I’ll give it a go now - was strugging to make sense of the build log |
e7a2cf0
to
1b8b582
Compare
The solution must work for any org. Per #1, "detect the name of the GitHub org from the Travis environment variables, and fetch the org's logo." |
@jayvdb sorry, should have read the issue in full before starting. Where would you find this environment variable? (couldn’t see any variables in .travis.yml relating to the org using the project) |
never mind, I think I found it in |
0e2a3e9
to
0548211
Compare
gci/logo.py
Outdated
image_url_short = "http://github.com/%s.png" % (org_name) | ||
|
||
#Follow the redirect to the page containing the image | ||
response = urllib.request.urlopen(IMAGE_URL_SHORT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use pypi package requests
gci/logo.py
Outdated
import urllib.request | ||
|
||
def get_logo(): | ||
#Obtain the org name from the Travis environment variables |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check your code with pyflakes & pycodestyle
gci/views.py
Outdated
get_logo() | ||
|
||
s.append('<link rel="shortcut icon" type="image/png" href="images/favicon.png"/>') | ||
s.append('<image href="images/favicon.png">') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this for? Seems like it's not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dob9601 Line 22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A review is usually given to the bottommost line in the "review window".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my mistake. Line 22 displays the image. Line 21 is a link to the favicon since it is in a png format and in a subfolder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean <img>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can’t believe I did that :( must have been half asleep when working on that
@blazeu could you narrow down to one line specifically |
@jayvdb Do you want me to approach the favicon with full backward compatibility (the creation of a 32x32 .ico file instead of just linking to a PNG)? |
Comment on 024634d, file gci/logo.py, line 7. You do not use the preferred quotation marks. Origin: QuotesBear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmppppvnesy/gci/logo.py
+++ b/tmp/tmppppvnesy/gci/logo.py
@@ -4,7 +4,7 @@
def get_logo():
# Obtain the org name from the Travis environment variables
- org_name = os.environ["TRAVIS_REPO_SLUG"].split("/")[0]
+ org_name = os.environ['TRAVIS_REPO_SLUG'].split("/")[0]
image_url_short_max_res = "http://github.com/%s.png" % (org_name)
|
Comment on 024634d, file gci/logo.py, line 7. You do not use the preferred quotation marks. Origin: QuotesBear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmppppvnesy/gci/logo.py
+++ b/tmp/tmppppvnesy/gci/logo.py
@@ -4,7 +4,7 @@
def get_logo():
# Obtain the org name from the Travis environment variables
- org_name = os.environ["TRAVIS_REPO_SLUG"].split("/")[0]
+ org_name = os.environ["TRAVIS_REPO_SLUG"].split('/')[0]
image_url_short_max_res = "http://github.com/%s.png" % (org_name)
|
Comment on 024634d, file gci/logo.py, line 9. You do not use the preferred quotation marks. Origin: QuotesBear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmppppvnesy/gci/logo.py
+++ b/tmp/tmppppvnesy/gci/logo.py
@@ -6,7 +6,7 @@
# Obtain the org name from the Travis environment variables
org_name = os.environ["TRAVIS_REPO_SLUG"].split("/")[0]
- image_url_short_max_res = "http://github.com/%s.png" % (org_name)
+ image_url_short_max_res = 'http://github.com/%s.png' % (org_name)
# Follow the redirect to the page containing the image and
# store it in the response variable |
Comment on 024634d, file gci/logo.py, line 16. You do not use the preferred quotation marks. Origin: QuotesBear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmppppvnesy/gci/logo.py
+++ b/tmp/tmppppvnesy/gci/logo.py
@@ -13,7 +13,7 @@
response_max_res = requests.get(image_url_short_max_res)
# Write the image to a file and save
- image = open("images/org_logo.png", "wb")
+ image = open('images/org_logo.png', "wb")
image.write(response_max_res.content)
image.close()
|
Comment on 024634d, file gci/logo.py, line 16. You do not use the preferred quotation marks. Origin: QuotesBear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmppppvnesy/gci/logo.py
+++ b/tmp/tmppppvnesy/gci/logo.py
@@ -13,7 +13,7 @@
response_max_res = requests.get(image_url_short_max_res)
# Write the image to a file and save
- image = open("images/org_logo.png", "wb")
+ image = open("images/org_logo.png", 'wb')
image.write(response_max_res.content)
image.close()
|
Comment on 024634d, file gci/logo.py, line 21. You do not use the preferred quotation marks. Origin: QuotesBear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmppppvnesy/gci/logo.py
+++ b/tmp/tmppppvnesy/gci/logo.py
@@ -18,7 +18,7 @@
image.close()
# Run the same code again but download a 16x16 version for favicon
- image_url_short_favicon = "http://github.com/%s.png?size=16" % (org_name)
+ image_url_short_favicon = 'http://github.com/%s.png?size=16' % (org_name)
response_favicon = requests.get(image_url_short_favicon)
|
Comment on 024634d, file gci/logo.py, line 25. You do not use the preferred quotation marks. Origin: QuotesBear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmppppvnesy/gci/logo.py
+++ b/tmp/tmppppvnesy/gci/logo.py
@@ -22,6 +22,6 @@
response_favicon = requests.get(image_url_short_favicon)
- image = open("favicon.png", "wb")
+ image = open('favicon.png', "wb")
image.write(response_favicon.content)
image.close() |
Comment on 024634d, file gci/logo.py, line 25. You do not use the preferred quotation marks. Origin: QuotesBear, Section: The issue can be fixed by applying the following patch: --- a/tmp/tmppppvnesy/gci/logo.py
+++ b/tmp/tmppppvnesy/gci/logo.py
@@ -22,6 +22,6 @@
response_favicon = requests.get(image_url_short_favicon)
- image = open("favicon.png", "wb")
+ image = open("favicon.png", 'wb')
image.write(response_favicon.content)
image.close() |
gci/logo.py
Outdated
|
||
response_favicon = requests.get(image_url_short_favicon) | ||
|
||
image = open('favicon.png', 'wb') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it rather be favicon.ico
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkprince007 most modern browsers support pngs
https://en.wikipedia.org/wiki/Favicon#File_format_support
(every one on wikipedia listed does)
gci/gitorg.py
Outdated
else: | ||
image_url = 'http://github.com/%s.png' % (org_name) | ||
|
||
return requests.get(image_url_short).content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not tested :P
yay; build errors fixed. here is what it looks like : https://pr-16--wonderful-williams-adc3fd.netlify.com/ |
5034214
to
5df8df0
Compare
gci/views.py
Outdated
org_logo_file.write(org_logo) | ||
|
||
s.append('<link rel="shortcut icon" type="image/png" href="favicon.png"/>') | ||
s.append('<img src="org_logo.png" alt='+org_name+'>') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alt="'+org_name+'"
gci/views.py
Outdated
with open('static/org_logo.png', 'wb') as org_logo_file: | ||
org_logo_file.write(org_logo) | ||
|
||
s.append('<link rel="shortcut icon" type="image/png" href="favicon.png"/>') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to add static/
to these URLs
gci/views.py
Outdated
@@ -16,6 +17,17 @@ def index(request): | |||
org_id = linked_students[0]['organization_id'] | |||
org_name = linked_students[0]['organization_name'] | |||
s = [] | |||
|
|||
favicon = get_logo(org_name, 16) | |||
with open('static/favicon.png', 'wb') as favicon_file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this needs to be _site/...
gci/views.py
Outdated
|
||
favicon = get_logo(org_name, 16) | ||
with open('_site/favicon.png', 'wb') as favicon_file: | ||
favicon_file.write(favicon) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (86 > 80 characters)
Origin: PycodestyleBear (E501), Section: all.autopep8
.
gci/views.py
Outdated
|
||
favicon = get_logo(org_name, 16) | ||
with open('_site/favicon.png', 'wb') as favicon_file: | ||
favicon_file.write(favicon) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is longer than allowed. (86 > 80)
Origin: LineLengthBear, Section: all.linelength
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have added the submodule "out"
unack 4ee9f38 |
Please squash all the commits into one commit. |
Needs another rebase, and please squash them into one commit.
|
unack 5ebcf0f |
Closes coala#1
uglyaf https://pr-16--wonderful-williams-adc3fd.netlify.com/ , but it works. |
ack eed7bd9 |
ack eed7bd9 |
Netlify build isnt the same as the Travis build |
closes #1