Skip to content

Commit a2bb0fb

Browse files
committed
Merge pull request #156 from ropensci/marianne-fix-response-filepath
Fix response filepath when contains directory
2 parents 7436af9 + dfa24ee commit a2bb0fb

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: plotly
22
Type: Package
33
Title: Interactive, publication-quality graphs online.
4-
Version: 0.5.17
4+
Version: 0.5.18
55
Authors@R: c(person("Chris", "Parmer", role = c("aut", "cre"),
66
email = "[email protected]"),
77
person("Scott", "Chamberlain", role = "aut",

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
0.5.18 -- 22 January 2015.
2+
3+
Return proper filepath when filename contains directories.
4+
15
0.5.17 -- 30 December 2014.
26

37
Support date-time binning in histograms.

R/plotly-package.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#' \itemize{
88
#' \item Package: plotly
99
#' \item Type: Package
10-
#' \item Version: 0.5.17
10+
#' \item Version: 0.5.18
1111
#' \item Date: 2014-03-07
1212
#' \item License: MIT
1313
#' }

R/plotly.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ For more help, see https://plot.ly/R or contact <[email protected]>.")
8282

8383
# public attributes/methods that the user has access to
8484
pub <- list(username=username, key=key, filename="from api", fileopt=NULL,
85-
version="0.5.17")
85+
version="0.5.18")
8686
priv <- list()
8787

8888
pub$makecall <- function(args, kwargs, origin) {
@@ -105,8 +105,8 @@ For more help, see https://plot.ly/R or contact <[email protected]>.")
105105
}
106106

107107
resp <- fromJSON(respst, simplify = FALSE)
108-
if (!is.null(resp$filename))
109-
pub$filename <- resp$filename
108+
if (!is.null(kwargs$filename))
109+
resp$filename <- kwargs$filename
110110
if (!is.null(resp$error))
111111
cat(resp$err)
112112
if (!is.null(resp$warning))

tests/testthat/test-plotly-filename.R

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
context("Filename")
2+
3+
test_that("filepath with directories is returned as passed", {
4+
x <- c(-1.50548425849621, 0.023267831354017, -1.38460390550496,
5+
-0.805552814226363, 1.59651736643461, 0.936302685370894,
6+
0.512729504994891, -0.24492573745161, -0.465348603632604,
7+
0.173523456651353, 0.389491211182137, -0.275308705542518,
8+
-0.132866228059449, -0.336255877656944, 0.916535489109209,
9+
-0.936870130264329, 0.363137478307925, -1.26433467241078,
10+
-0.388804188531171, 0.785842426281935)
11+
data = list(x=x, type="histogramx")
12+
l <- list(autosize=FALSE, width=600, height=400, showlegend=FALSE)
13+
14+
py <- plotly("get_test_user_2", "0f9es4r6tm")
15+
response <- py$plotly(data, kwargs=list(layout=l, filename="directory/hist",
16+
fileopt="overwrite"))
17+
18+
expect_identical(response$filename, "directory/hist")
19+
20+
})

0 commit comments

Comments
 (0)