Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix IP URL previews on Python 3 #4215

Merged
merged 31 commits into from
Dec 21, 2018
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9e0ae2f
fix
hawkowl Nov 21, 2018
1474953
changelog
hawkowl Nov 21, 2018
31e0fd9
fixes
hawkowl Nov 21, 2018
1520252
fixes
hawkowl Nov 21, 2018
ec14bca
fixes
hawkowl Nov 21, 2018
7af04df
fix pep8
hawkowl Nov 21, 2018
606e39b
fix pep8
hawkowl Nov 21, 2018
759169b
add some code coverage to blacklists
hawkowl Nov 22, 2018
a2f7ae1
tests
hawkowl Nov 26, 2018
a94ca42
Merge remote-tracking branch 'origin/develop' into hawkowl/ip-preview
hawkowl Nov 26, 2018
ca82572
fix pep8
hawkowl Nov 26, 2018
4c246c0
Merge remote-tracking branch 'origin/develop' into hawkowl/ip-preview
hawkowl Nov 28, 2018
fc1dd48
cleanup
hawkowl Nov 28, 2018
c70d2a1
log when we block
hawkowl Nov 30, 2018
5756f64
docstring
hawkowl Nov 30, 2018
0421f0b
docstring
hawkowl Nov 30, 2018
e59a5ee
comment
hawkowl Nov 30, 2018
4357b85
Merge remote-tracking branch 'origin/develop' into hawkowl/ip-preview
hawkowl Dec 5, 2018
d82e498
fix
hawkowl Dec 5, 2018
1210131
merge in tests
hawkowl Dec 5, 2018
6fade49
fix
hawkowl Dec 5, 2018
168a494
fix
hawkowl Dec 5, 2018
920625f
fix
hawkowl Dec 5, 2018
7d17b47
fix py2
hawkowl Dec 5, 2018
1d40dd5
Merge remote-tracking branch 'origin/develop' into hawkowl/ip-preview
hawkowl Dec 14, 2018
79a5655
fix missing hyperlink
hawkowl Dec 14, 2018
aac9bb4
Merge remote-tracking branch 'origin/develop' into hawkowl/ip-preview
hawkowl Dec 20, 2018
34952ce
review comments
hawkowl Dec 20, 2018
9e64ab8
review comments
hawkowl Dec 20, 2018
3b9e190
urllib does what we need here
hawkowl Dec 20, 2018
cfa8f6f
Merge branch 'develop' into hawkowl/ip-preview
hawkowl Dec 21, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ source=

[report]
precision = 2
ignore_errors = True
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ env/

.vscode/
.ropeproject/
.coverage.*
1 change: 1 addition & 0 deletions changelog.d/4215.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Getting URL previews of IP addresses no longer fails on Python 3.
10 changes: 10 additions & 0 deletions synapse/config/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
"Missing netaddr library. This is required for URL preview API."
)

MISSING_HYPERLINK = (
"Missing hyperlink library. This is required for URL preview API."
)

MISSING_LXML = (
"""Missing lxml library. This is required for URL preview API.

Expand Down Expand Up @@ -151,6 +155,12 @@ def read_config(self, config):
except ImportError:
raise ConfigError(MISSING_LXML)

try:
import hyperlink
Copy link
Member

Choose a reason for hiding this comment

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

we'll need to document this in the README (grep for lxml - there's more than one place) as well as the upgrade notes, and put something in the changelog about it, to stop people getting surprised by it suddenly not working.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should only affect people on Twisteds older than 17.5, which hard depends on hyperlink. (I guess this affects xenial and so?) Maybe I should add it to our pip dependencies?

hyperlink # To stop unused lint.
except ImportError:
raise ConfigError(MISSING_HYPERLINK)

try:
from netaddr import IPSet
except ImportError:
Expand Down
Loading