Permalink
Browse files

Rename *ignore-slots* to *json-ignore-slots* and make external, so th…

…at a json exporter can override the ignoring of the ID slot
  • Loading branch information...
1 parent e3c0261 commit 7d698f43d0b1a7f2ace64c9343d312ee47e69add @wesen wesen committed Apr 16, 2011
Showing with 5 additions and 5 deletions.
  1. +3 −4 src/data/json.lisp
  2. +2 −1 src/data/package.lisp
View
7 src/data/json.lisp
@@ -1,17 +1,16 @@
(in-package :bknr.datastore)
-(defparameter *ignore-slots* '(bknr.datastore::id bknr.indices::destroyed-p))
+(defparameter *json-ignore-slots* '(bknr.datastore::id bknr.indices::destroyed-p))
(defmacro with-json-ignore-slots ((&rest slots) &body body)
- `(let ((*ignore-slots* (append *ignore-slots* ,slots)))
+ `(let ((*json-ignore-slots* (append *json-ignore-slots* ,slots)))
,@body))
(defmethod json:encode ((object store-object) &optional (stream *standard-output*))
(json:with-output (stream)
(json:with-object ()
(dolist (slotdef (closer-mop:class-slots (class-of object)))
(when (and (slot-boundp object (closer-mop:slot-definition-name slotdef))
- (not (find (closer-mop:slot-definition-name slotdef) *ignore-slots*)))
- (json:encode-object-element (closer-mop:slot-definition-name slotdef)
+ (not (find (closer-mop:slot-definition-name slotdef) *json-ignore-slots*)))
(json:encode-object-element (string-downcase (symbol-name (closer-mop:slot-definition-name slotdef)))
(slot-value object (closer-mop:slot-definition-name slotdef))))))))
View
3 src/data/package.lisp
@@ -125,7 +125,8 @@
#:ensure-store-current-directory
;; JSON serialization
- #:with-json-ignore-slots))
+ #:with-json-ignore-slots
+ #:*json-ignore-slots*))
(defpackage :bknr.datastore.tests
(:use :cl :bknr.datastore :bknr.indices :unit-test))

0 comments on commit 7d698f4

Please sign in to comment.