[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/webpaste 95de0b8 169/298: Remove sync as a provider parame
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/webpaste 95de0b8 169/298: Remove sync as a provider parameter on creation and add it on execution |
Date: |
Thu, 9 Dec 2021 19:00:07 -0500 (EST) |
branch: elpa/webpaste
commit 95de0b8d06fdebe8a8afb6790d4678e82e6ee8c2
Author: Elis Axelsson <elis.axelsson@gmail.com>
Commit: Elis Axelsson <elis.axelsson@gmail.com>
Remove sync as a provider parameter on creation and add it on execution
---
tests/unit/test-webpaste-provider-creation.el | 9 ++----
webpaste.el | 45 +++++++++++++--------------
2 files changed, 25 insertions(+), 29 deletions(-)
diff --git a/tests/unit/test-webpaste-provider-creation.el
b/tests/unit/test-webpaste-provider-creation.el
index a7f5c3f..ece72a3 100644
--- a/tests/unit/test-webpaste-provider-creation.el
+++ b/tests/unit/test-webpaste-provider-creation.el
@@ -15,7 +15,6 @@
(webpaste-provider
:uri "http://invalid-domain-name/"
:post-field "data"
- :sync t
:success-lambda (lambda () (cl-function
(lambda (&key data &allow-other-keys)
(setq used-lambda "success"))))
@@ -27,7 +26,6 @@
(webpaste-provider
:uri "https://httpbin.org/status/200"
:post-field "data"
- :sync t
:success-lambda (lambda () (cl-function
(lambda (&key data &allow-other-keys)
(setq used-lambda "success"))))
@@ -39,7 +37,7 @@
(it
"can trigger the error lambda of a provider"
(let ((used-lambda nil))
- (funcall broken-provider "my test text")
+ (funcall broken-provider "my test text" :sync t)
(expect used-lambda :to-equal "error")))
@@ -47,7 +45,7 @@
(it
"can trigger the success lambda of a provider"
(let ((used-lambda nil))
- (funcall working-provider "my test text")
+ (funcall working-provider "my test text" :sync t)
(expect used-lambda :to-equal "success")))
@@ -62,7 +60,6 @@
(provider (webpaste-provider
:uri "http://invalid-domain-name/"
:post-field "data"
- :sync t
:success-lambda (cl-function
(lambda (&key data &allow-other-keys)
(setq used-lambda "success")))
@@ -70,7 +67,7 @@
(lambda (&key error-thrown &allow-other-keys)
(funcall working-provider "failover"))))))
- (funcall provider "text")
+ (funcall provider "text" :sync t)
(expect used-lambda :to-equal "success"))))
diff --git a/webpaste.el b/webpaste.el
index 8ee39be..dc9b240 100644
--- a/webpaste.el
+++ b/webpaste.el
@@ -184,8 +184,7 @@ precalculated, and also available both for pre and post
request access.")
(lang-overrides '())
(lang-uri-separator nil)
(error-lambda
'webpaste/providers-error-lambda)
- (post-field-lambda
'webpaste/providers-default-post-field-lambda)
- (sync nil))
+ (post-field-lambda
'webpaste/providers-default-post-field-lambda))
"Function to create the lambda function for a provider.
Usage:
@@ -237,10 +236,7 @@ Optional params:
TEXT contains the data that should be sent.
POST-FIELD cointains the name of the field to be sent.
- POST-DATA contains predefined fields that the provider
needs.
-
-:sync Set to t to wait until request is done. Defaults to nil.
- This should only be used for debugging purposes."
+ POST-DATA contains predefined fields that the provider
needs."
;; If we get a separator sent to the function, append it to the list of
;; separators for later use
(when lang-uri-separator
@@ -250,23 +246,26 @@ Optional params:
(cl-pushnew (cons uri (webpaste/get-lang-alist-with-overrides
lang-overrides))
webpaste/provider-lang-alists)
- (lambda (text)
- "Paste TEXT to provider"
-
- (prog1 nil
- ;; Do request
- (request uri
- :type type
- :data (funcall (funcall post-field-lambda)
- :text text
- :provider-uri uri
- :post-field post-field
- :post-lang-field-name post-lang-field-name
- :post-data post-data)
- :parser parser
- :success (funcall success-lambda)
- :sync sync
- :error (funcall error-lambda :text text)))))
+ (cl-function
+ (lambda (text
+ &key
+ (sync nil))
+ "Paste TEXT to provider. Force SYNC if needed for debugging."
+
+ (prog1 nil
+ ;; Do request
+ (request uri
+ :type type
+ :data (funcall (funcall post-field-lambda)
+ :text text
+ :provider-uri uri
+ :post-field post-field
+ :post-lang-field-name post-lang-field-name
+ :post-data post-data)
+ :parser parser
+ :success (funcall success-lambda)
+ :sync sync
+ :error (funcall error-lambda :text text))))))
- [nongnu] elpa/webpaste 29d10d7 151/298: Added paste.pound-python.org as provider, (continued)
- [nongnu] elpa/webpaste 29d10d7 151/298: Added paste.pound-python.org as provider, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 410e286 152/298: Added webpaste confirmation tests, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste db8c605 154/298: Rewrite test to cover both if link is opened in external browser or not, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 6b93c89 153/298: Merge branch 'naclander-master', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste d2ed48a 156/298: Added unit test for appending of language to returning links, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 899e08e 157/298: Change install method of emacs in travis for faster build times, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste e87a37c 158/298: Switched from ert to buttercup for testing, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 865ff10 159/298: Disable this test for now since it breaks, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 59fd22f 161/298: Merge branch 'naclander-POST-bug', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste d475f02 170/298: Added integration test for ptpb.pw, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 95de0b8 169/298: Remove sync as a provider parameter on creation and add it on execution,
ELPA Syncer <=
- [nongnu] elpa/webpaste fd4332a 172/298: Merge branch 'test-providers-on-travis', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 60c0a98 167/298: Added printing of travis event type, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste d0442ad 168/298: Renamed all unit tests to make it easier for integration tests, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste cac4979 173/298: Added option to send returned URL to clpboard, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste db393a1 175/298: Merge branch 'naclander-copy-to-clipboard', ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 92f309e 188/298: Added a contributing guidelines file, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste ddd2fca 186/298: Added tests for success lambdas, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 2a05d02 194/298: Added supports for custom hooks when returning URLs. This fixes #22., ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste b96e411 204/298: Moved the paste message to be a variable used for all integration tests, ELPA Syncer, 2021/12/09
- [nongnu] elpa/webpaste 26f089e 201/298: Rename webpaste-paste-text and webpaste-paste-text-to-provider to be in "private scope", ELPA Syncer, 2021/12/09