moved slot initialisation from before render-on to make-presentation time.
[clinton/lisp-on-lines.git] / src / mewa / mewa.lisp
index 8509f2d..ce7ffb3 100644 (file)
@@ -12,9 +12,7 @@
 ;;; some utilities for merging plists
 
 (defun plist-nunion (new-props plist)
-  (loop for cons on new-props
-       for i from 1
-       when (oddp i)
+  (loop for cons on new-props by #'cddr
        do (setf (getf plist (first cons)) (second cons))
        finally (return plist)))
 
@@ -88,7 +86,6 @@ attributes is an alist keyed on the attribute nreeame."
 
 (defmethod default-attributes ((model t))
   (append (mapcar #'(lambda (s) (cons (car s) (gen-pslot (if (meta-model:foreign-key-p model (car s))
-                                                  'ucw::foreign-key
                                                   (cadr s))
                                                 (string (car s)) (car s)))) 
          (meta-model:list-slot-types model))
@@ -130,7 +127,8 @@ attributes is an alist keyed on the attribute nreeame."
     :accessor use-instance-class-p 
     :initform t)
    (initializedp :initform nil)
-   (modifiedp :accessor modifiedp :initform nil)))
+   (modifiedp :accessor modifiedp :initform nil)
+   (modifications :accessor modifications :initform nil)))
 
 
 (defmethod attributes :around ((self mewa))
@@ -217,12 +215,6 @@ attributes is an alist keyed on the attribute nreeame."
   (setf (slots self) (find-slot-presentations   self)))
   
 
-(defmethod render-on :around ((res response) (self mewa))
-  (unless (slot-value self 'initializedp)
-    (initialize-slots self))
-  (setf (slot-value self 'initializedp) t)
-  (call-next-method))
-
 
 (defmethod make-presentation ((object t) &key (type :viewer) (initargs nil))
   (let* ((p (make-instance 'mewa-object-presentation))
@@ -249,6 +241,8 @@ attributes is an alist keyed on the attribute nreeame."
                                           type))
                                       (plist-union initargs (cddr a)))))
     (setf (slot-value i 'instance) object)
+    (initialize-slots i)
+    (setf (slot-value i 'initializedp) t)
     i))