summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2024-01-01 09:21:54 +0000
committerLars Wirzenius <liw@liw.fi>2024-01-01 09:21:54 +0000
commit4cc2f966760bd5afcbc364b7e9c552211382ee71 (patch)
tree1128bfd239951e1e50a34d699a94c81575d8b096
parent420646fa118d375d2871452d03638e3472ecf031 (diff)
parent24999fd849c3cb103f4d38564a7a52e7bae7c5cd (diff)
downloadobnam2-4cc2f966760bd5afcbc364b7e9c552211382ee71.tar.gz
Merge branch 'liw/fix' into 'main'
fix things up so ./check is happy See merge request obnam/obnam!249
-rw-r--r--src/db.rs10
-rw-r--r--subplot/server.yaml10
2 files changed, 12 insertions, 8 deletions
diff --git a/src/db.rs b/src/db.rs
index da24e96..392134d 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -428,10 +428,7 @@ impl<'a> ToSql for Value<'a> {
i64::try_from(*v)
.map_err(|err| rusqlite::Error::ToSqlConversionFailure(Box::new(err)))?,
),
- Self::Bool(_, v) => ValueRef::Integer(
- i64::try_from(*v)
- .map_err(|err| rusqlite::Error::ToSqlConversionFailure(Box::new(err)))?,
- ),
+ Self::Bool(_, v) => ValueRef::Integer(i64::from(*v)),
Self::Text(_, v) => ValueRef::Text(v.as_ref()),
Self::Blob(_, v) => ValueRef::Blob(v),
};
@@ -478,10 +475,7 @@ impl ToSql for OwnedValue {
i64::try_from(*v)
.map_err(|err| rusqlite::Error::ToSqlConversionFailure(Box::new(err)))?,
),
- Self::Bool(_, v) => Value::Integer(
- i64::try_from(*v)
- .map_err(|err| rusqlite::Error::ToSqlConversionFailure(Box::new(err)))?,
- ),
+ Self::Bool(_, v) => Value::Integer(i64::from(*v)),
Self::Text(_, v) => Value::Text(v.to_string()),
Self::Blob(_, v) => Value::Blob(v.to_vec()),
};
diff --git a/subplot/server.yaml b/subplot/server.yaml
index ac45cac..cf57931 100644
--- a/subplot/server.yaml
+++ b/subplot/server.yaml
@@ -17,6 +17,11 @@
- when: "I POST (?P<filename>\\S+) to (?P<path>\\S+), with (?P<header>\\S+): (?P<json>.*)"
regex: true
+ types:
+ filename: word
+ path: word
+ header: word
+ json: text
impl:
python:
function: post_file
@@ -63,12 +68,17 @@
function: header_is
- then: "the JSON body has a field {field}, henceforth {var}"
+ types:
+ field: word
+ var: word
impl:
python:
function: remember_json_field
- then: "the JSON body matches (?P<wanted>.*)"
regex: true
+ types:
+ wanted: text
impl:
python:
function: json_body_matches