kopia lustrzana https://github.com/wagtail/wagtail
Update signals.rst for Python 3 compatibility
The send_to_slack example was not compatible with Python 3. Example is updated using the requests & json libraries (instead of urllib & urllib2)pull/6075/head
rodzic
a7ddb056b8
commit
147fda12fa
|
@ -463,6 +463,7 @@ Contributors
|
|||
* Brylie Christopher Oxley
|
||||
* Lacey Williams Henschel
|
||||
* Dan Bentley
|
||||
* GTpyro
|
||||
|
||||
Translators
|
||||
===========
|
||||
|
|
|
@ -26,8 +26,7 @@ example showing how you might notify your team when something is published:
|
|||
.. code-block:: python
|
||||
|
||||
from wagtail.core.signals import page_published
|
||||
import urllib
|
||||
import urllib2
|
||||
import requests
|
||||
|
||||
|
||||
# Let everyone know when a new page is published
|
||||
|
@ -41,9 +40,7 @@ example showing how you might notify your team when something is published:
|
|||
"icon_emoji": ":octopus:"
|
||||
}
|
||||
|
||||
data = urllib.urlencode(values)
|
||||
req = urllib2.Request(url, data)
|
||||
response = urllib2.urlopen(req)
|
||||
response = requests.post(url, values)
|
||||
|
||||
# Register a receiver
|
||||
page_published.connect(send_to_slack)
|
||||
|
|
Ładowanie…
Reference in New Issue