Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
a349f728
Commit
a349f728
authored
Jul 03, 2017
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed displaying the owner of a failed icon retrieval
parent
8ae35147
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
contacts.py
blink/contacts.py
+7
-6
No files found.
blink/contacts.py
View file @
a349f728
...
@@ -481,6 +481,7 @@ class GoogleContactIconRetriever(object):
...
@@ -481,6 +481,7 @@ class GoogleContactIconRetriever(object):
@
run_in_threadpool
(
threadpool
)
@
run_in_threadpool
(
threadpool
)
def
run
(
self
):
def
run
(
self
):
owner
=
self
.
contact
.
name
or
self
.
contact
.
organization
or
self
.
contact
.
id
icon
=
self
.
contact
.
icon
icon
=
self
.
contact
.
icon
http
=
self
.
credentials
.
authorize
(
Http
(
timeout
=
5
))
http
=
self
.
credentials
.
authorize
(
Http
(
timeout
=
5
))
try
:
try
:
...
@@ -489,7 +490,7 @@ class GoogleContactIconRetriever(object):
...
@@ -489,7 +490,7 @@ class GoogleContactIconRetriever(object):
else
:
else
:
response
=
content
=
None
response
=
content
=
None
except
(
HttpLib2Error
,
socket
.
error
)
as
e
:
except
(
HttpLib2Error
,
socket
.
error
)
as
e
:
log
.
warning
(
u
"could not retrieve icon for {}: {!s}"
.
format
(
self
.
contact
.
name
,
e
))
log
.
warning
(
u
'could not retrieve icon for {owner}: {exception!s}'
.
format
(
owner
=
owner
,
exception
=
e
))
else
:
else
:
if
response
is
None
:
if
response
is
None
:
icon_manager
=
IconManager
()
icon_manager
=
IconManager
()
...
@@ -500,27 +501,27 @@ class GoogleContactIconRetriever(object):
...
@@ -500,27 +501,27 @@ class GoogleContactIconRetriever(object):
try
:
try
:
icon_manager
.
store_data
(
self
.
contact
.
id
,
content
)
icon_manager
.
store_data
(
self
.
contact
.
id
,
content
)
except
Exception
as
e
:
except
Exception
as
e
:
log
.
error
(
u
"could not store icon for {}: {!s}"
.
format
(
self
.
contact
.
name
,
e
))
log
.
error
(
u
'could not store icon for {owner}: {exception!s}'
.
format
(
owner
=
owner
,
exception
=
e
))
else
:
else
:
icon
.
downloaded_url
=
icon
.
url
icon
.
downloaded_url
=
icon
.
url
elif
response
[
'status'
]
in
(
'403'
,
'404'
)
and
icon
.
alternate_url
:
# private or unavailable photo. use old GData protocol if alternate_url is available.
elif
response
[
'status'
]
in
(
'403'
,
'404'
)
and
icon
.
alternate_url
:
# private or unavailable photo. use old GData protocol if alternate_url is available.
try
:
try
:
response
,
content
=
http
.
request
(
icon
.
alternate_url
,
headers
=
{
'GData-Version'
:
'3.0'
})
response
,
content
=
http
.
request
(
icon
.
alternate_url
,
headers
=
{
'GData-Version'
:
'3.0'
})
except
(
HttpLib2Error
,
socket
.
error
)
as
e
:
except
(
HttpLib2Error
,
socket
.
error
)
as
e
:
log
.
warning
(
u
"could not retrieve icon for {}: {!s}"
.
format
(
self
.
contact
.
name
,
e
))
log
.
warning
(
u
'could not retrieve icon for {owner}: {exception!s}'
.
format
(
owner
=
owner
,
exception
=
e
))
else
:
else
:
if
response
[
'status'
]
==
'200'
and
response
[
'content-type'
]
.
startswith
(
'image/'
):
if
response
[
'status'
]
==
'200'
and
response
[
'content-type'
]
.
startswith
(
'image/'
):
icon_manager
=
IconManager
()
icon_manager
=
IconManager
()
try
:
try
:
icon_manager
.
store_data
(
self
.
contact
.
id
,
content
)
icon_manager
.
store_data
(
self
.
contact
.
id
,
content
)
except
Exception
as
e
:
except
Exception
as
e
:
log
.
error
(
u
"could not store icon for {}: {!s}"
.
format
(
self
.
contact
.
name
,
e
))
log
.
error
(
u
'could not store icon for {owner}: {exception!s}'
.
format
(
owner
=
owner
,
exception
=
e
))
else
:
else
:
icon
.
downloaded_url
=
icon
.
url
icon
.
downloaded_url
=
icon
.
url
else
:
else
:
log
.
error
(
u
"could not retrieve icon for {} (status={}, content type={})"
.
format
(
self
.
contact
.
name
,
response
[
'status'
],
response
[
'content-type'
]))
log
.
error
(
u
'could not retrieve icon for {} (status={}, content-type={!r})'
.
format
(
owner
,
response
[
'status'
],
response
[
'content-type'
]))
else
:
else
:
log
.
error
(
u
"could not retrieve icon for {} (status={}, content type={})"
.
format
(
self
.
contact
.
name
,
response
[
'status'
],
response
[
'content-type'
]))
log
.
error
(
u
'could not retrieve icon for {} (status={}, content-type={!r})'
.
format
(
owner
,
response
[
'status'
],
response
[
'content-type'
]))
finally
:
finally
:
self
.
_event
.
set
()
self
.
_event
.
set
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment