Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit182a219

Browse files
committed
Merge branch 'master' of github.com:bpython/bpython
2 parents432c5c2 +baeffa8 commit182a219

File tree

5 files changed

+20
-42
lines changed

5 files changed

+20
-42
lines changed

‎CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ General information:
1010
* Usage in combination with Python 2 has been deprecated. This does not mean that
1111
support is dropped instantly but rather that at some point in the future we will
1212
stop running our testcases against Python 2.
13+
* The new pinnwand API is used for the pastebin functionality. We have dropped
14+
two configuration options: `pastebin_show_url` and `pastebin_removal_url`. If
15+
you have your bpython configured to run against an old version of `pinnwand`
16+
please update it.
1317

1418
New features:
1519

‎bpython/config.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ def loadini(struct, configfile):
8181
"pastebin_confirm":True,
8282
"pastebin_expiry":"1week",
8383
"pastebin_helper":"",
84-
"pastebin_removal_url":"https://bpaste.net/remove/$removal_id",
85-
"pastebin_show_url":"https://bpaste.net/show/$paste_id",
86-
"pastebin_url":"https://bpaste.net/json/new",
84+
"pastebin_url":"https://bpaste.net",
8785
"save_append_py":False,
8886
"single_undo_time":1.0,
8987
"syntax":True,
@@ -224,8 +222,6 @@ def get_key_no_doublebind(command):
224222

225223
struct.pastebin_confirm=config.getboolean("general","pastebin_confirm")
226224
struct.pastebin_url=config.get("general","pastebin_url")
227-
struct.pastebin_show_url=config.get("general","pastebin_show_url")
228-
struct.pastebin_removal_url=config.get("general","pastebin_removal_url")
229225
struct.pastebin_expiry=config.get("general","pastebin_expiry")
230226
struct.pastebin_helper=config.get("general","pastebin_helper")
231227

‎bpython/paste.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,29 @@ class PasteFailed(Exception):
4040

4141

4242
classPastePinnwand(object):
43-
def__init__(self,url,expiry,show_url,removal_url):
43+
def__init__(self,url,expiry):
4444
self.url=url
4545
self.expiry=expiry
46-
self.show_url=show_url
47-
self.removal_url=removal_url
4846

4947
defpaste(self,s):
5048
"""Upload to pastebin via json interface."""
5149

52-
url=urljoin(self.url,"/json/new")
53-
payload= {"code":s,"lexer":"pycon","expiry":self.expiry}
50+
url=urljoin(self.url,"/api/v1/paste")
51+
payload= {
52+
"expiry":self.expiry,
53+
"files": [{"lexer":"pycon","content":s}],
54+
}
5455

5556
try:
56-
response=requests.post(url,data=payload,verify=True)
57+
response=requests.post(url,json=payload,verify=True)
5758
response.raise_for_status()
5859
exceptrequests.exceptions.RequestExceptionasexc:
5960
raisePasteFailed(exc.message)
6061

6162
data=response.json()
6263

63-
paste_url_template=Template(self.show_url)
64-
paste_id=urlquote(data["paste_id"])
65-
paste_url=paste_url_template.safe_substitute(paste_id=paste_id)
66-
67-
removal_url_template=Template(self.removal_url)
68-
removal_id=urlquote(data["removal_id"])
69-
removal_url=removal_url_template.safe_substitute(
70-
removal_id=removal_id
71-
)
64+
paste_url=data["link"]
65+
removal_url=data["removal"]
7266

7367
return (paste_url,removal_url)
7468

‎bpython/repl.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,7 @@ def __init__(self, interp, config):
475475
self.paster=PasteHelper(self.config.pastebin_helper)
476476
else:
477477
self.paster=PastePinnwand(
478-
self.config.pastebin_url,
479-
self.config.pastebin_expiry,
480-
self.config.pastebin_show_url,
481-
self.config.pastebin_removal_url,
478+
self.config.pastebin_url,self.config.pastebin_expiry,
482479
)
483480

484481
@property

‎doc/sphinx/source/configuration-options.rst

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,9 @@ pastebin_helper
9191
^^^^^^^^^^^^^^^
9292

9393
The name of a helper executable that should perform pastebin upload on bpython's
94-
behalf. If set, this overrides `pastebin_url`. It also overrides
95-
`pastebin_show_url`, as the helper is expected to return the full URL to the
96-
pastebin as the first word of its output. The data is supplied to the helper via
97-
STDIN.
94+
behalf. If set, this overrides `pastebin_url`. The helper is expected to return
95+
the full URL to the pastebin as the first word of its output. The data is
96+
supplied to the helper via STDIN.
9897

9998
An example helper program is ``pastebinit``, available for most systems. The
10099
following helper program can be used to create `gists
@@ -141,23 +140,11 @@ following helper program can be used to create `gists
141140
142141
..versionadded::0.12
143142

144-
pastebin_show_url
145-
^^^^^^^^^^^^^^^^^
146-
The url under which the new paste can be reached. ``$paste_id`` will be replaced
147-
by the ID of the new paste (default: https://bpaste.net/show/$paste_id/).
148-
149-
pastebin_removal_url
150-
^^^^^^^^^^^^^^^^^^^^
151-
The url under which a paste can be removed. ``$removal_id`` will be replaced by
152-
the removal ID of the paste (default: https://bpaste.net/remova/$removal_id/).
153-
154-
..versionadded::0.14
155-
156143
pastebin_url
157144
^^^^^^^^^^^^
158145
The pastebin url to post to (without a trailing slash). This pastebin has to be
159-
a pastebin whichusesprovides a similar interface to ``bpaste.net``'s JSON
160-
interface (default: https://bpaste.net/json/new).
146+
a pastebin which provides a similar interface to ``bpaste.net``'s JSON
147+
interface (default: https://bpaste.net).
161148

162149
save_append_py
163150
^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp