Hi,

Here is another patch to fix access to the `*store-controller*' special
variable in `src/store/elephant/proxy.lisp'.

Without this patch, proxy objects instantiated with
`make-proxy-instance' will be stored in the last defined store
regardless of the value of `*default-store*' or the value of the
default-store webapp slot.

Regards,
Andrea.

-- 
Reclama i tuoi diritti digitali, elimina il DRM.  Approfondisci su
http://www.no1984.org
Reclaim your digital rights, eliminate DRM.  Learn more at
http://www.defectivebydesign.org/what_is_drm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"weblocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/weblocks?hl=en
-~----------~----~----~----~------~----~------~--~---

# HG changeset patch
# User Andrea Russo <[email protected]>
# Date 1244997967 -7200
# Node ID ce19ea797a36af02ac20c1d11f364eb9d4f109f8
# Parent  fd4137d4b94fd334c2d1b727561c03a6fccd984b
* proxy.lisp (persist-object): Fix `*store-controller*' access.
Use the `with-store-controller' macro to correctly access the
`*store-controller*' special variable.

diff -r fd4137d4b94f -r ce19ea797a36 src/store/elephant/proxy.lisp
--- a/src/store/elephant/proxy.lisp	Wed Jun 03 09:24:10 2009 +0200
+++ b/src/store/elephant/proxy.lisp	Sun Jun 14 18:46:07 2009 +0200
@@ -72,17 +72,18 @@
 (defmethod persist-object ((store elephant-store) (object persistent-proxy) &key)
   "Catch when weblocks tries to persist a proxy object and create an instance
    of the persistent-object"
-  (if (proxy-oid object)
-      (elephant::controller-recreate-instance *store-controller* (proxy-oid object))
-      (let ((instance (make-instance (base-class object))))
-	(loop for slot in (weblocks::class-slots (class-of object)) do
-	     (let ((slotname (weblocks::slot-definition-name slot)))
-	       (unless (or (eq slotname 'base-class)
-			   (eq slotname 'proxy-oid))
-		 (setf (slot-value instance slotname)
-		       (slot-value object slotname)))))
-	(setf (proxy-oid object) (elephant::oid instance))
-	instance)))
+  (with-store-controller store
+    (if (proxy-oid object)
+        (elephant::controller-recreate-instance *store-controller* (proxy-oid object))
+        (let ((instance (make-instance (base-class object))))
+          (loop for slot in (weblocks::class-slots (class-of object)) do
+               (let ((slotname (weblocks::slot-definition-name slot)))
+                 (unless (or (eq slotname 'base-class)
+                             (eq slotname 'proxy-oid))
+                   (setf (slot-value instance slotname)
+                         (slot-value object slotname)))))
+          (setf (proxy-oid object) (elephant::oid instance))
+          instance))))
 
 (defmethod object-class-name ((obj persistent-proxy))
   (base-class obj))

Reply via email to