Skip to content

Commit

Permalink
reset dirty slots after initialization, because they are not really d…
Browse files Browse the repository at this point in the history
…irty if we are setting their initial value
  • Loading branch information
bobbysmith007 committed Jul 26, 2013
1 parent 0ae72d0 commit aeca964
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dirty.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
(old-value :accessor old-value :initarg :old-value :initform nil)
(new-value :accessor new-value :initarg :new-value :initform nil)))

(defmethod print-object ((o dirty-slot) s)
"Print the auto-print-items for this instance."
(print-unreadable-object (o s :type t :identity t)
(ignore-errors (format s "~A" (slot-name o)))))

(defun make-dirty-slot (name old new)
(make-instance 'dirty-slot :slot-name name :old-value old :new-value new))

Expand All @@ -17,6 +22,14 @@
:db-kind :virtual))
(:metaclass clsql-sys::standard-db-class))

(defmethod initialize-instance :after ((o dirty-db-slots-mixin)
&key &allow-other-keys)
;; lets reset any changes caused by initialization
;; Not sure if this is correct, but other mixins are setting
;; values during init, which are not particularly dirty
;; (ie they havent changed, just got set)
(reset-dirty o))

(defun find-dirty-test ( o slot-name )
(or
(iter (for (slot-names . test) in (dirty-test o))
Expand Down

0 comments on commit aeca964

Please sign in to comment.