summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2017-11-15 21:12:09 +0100
committerRicardo Wurmus <rekado@elephly.net>2017-11-15 21:12:09 +0100
commit7111edab4f2f5bf8860f3a640021c94607516749 (patch)
treee7423d5727e0542c9e17f03555ff1fb7b111cf64
parent4fd6942274ed22f5829d6aed340aa7fdb544ff30 (diff)
debbugs: bug: Parse timestamps and booleans.
* debbugs/bug.scm (soap-bug->bug): Parse timestamps (date, log-modified, last-modified) and booleans (archived, unarchived). * README.org: Remove parsing of raw values from list of missing features.
-rw-r--r--README.org1
-rw-r--r--debbugs/bug.scm14
2 files changed, 14 insertions, 1 deletions
diff --git a/README.org b/README.org
index a34dab2..d6c2175 100644
--- a/README.org
+++ b/README.org
@@ -16,7 +16,6 @@ tracker.
+ TLS support (required for GNU debbugs instance)
+ convenience procedures for =<bug>= records (e.g. =bug-done?=)
-+ parsing of raw values (e.g. timestamps)
+ monadic interface
* Hacking
diff --git a/debbugs/bug.scm b/debbugs/bug.scm
index 62b8cfc..0b10979 100644
--- a/debbugs/bug.scm
+++ b/debbugs/bug.scm
@@ -20,6 +20,7 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
#:use-module (srfi srfi-9 gnu)
+ #:use-module (srfi srfi-19)
#:use-module (ice-9 match)
#:use-module ((sxml xpath) #:hide (filter))
#:use-module (debbugs soap)
@@ -113,6 +114,19 @@
(let ((bug-properties
(map soap->scheme ((sxpath '(urn:Debbugs/SOAP:value *any*)) bug-item))))
(apply bug (append-map (match-lambda
+ ;; timestamps
+ ((and ((or 'date 'log-modified 'last-modified) . _)
+ (key . value))
+ (list (symbol->keyword key)
+ (time-utc->date (make-time time-utc 0 value))))
+ ;; booleans
+ ((and ((or 'archived 'unarchived) . _)
+ (key . value))
+ (list (symbol->keyword key)
+ (if (number? value)
+ ((negate zero?) value)
+ #f)))
+ ;; anything else
((key . value)
(list (symbol->keyword key) value)))
(filter (match-lambda