I noticed that some of the common functionality (http response
backtraces, *catch-errors-p* etc no longer work). We probably need to
do our own call to *debugger-hook* in debug mode rather than relying
on hunchentoot to do that for us.
I added a simple version of this to the dispatcher, and also have some
minor patches for clozure-cl and updates that broke the elephant
backend. Let me know if there is a better way to send this, it seems
a bit of overkill to make a clone just for a small patch... :)
Who is maintaining the cl-json version we're using with weblocks? I
have fixes for that also.
Ian
diff -r cd83809dfadc src/snippets/menu.lisp
--- a/src/store/elephant/elephant.lisp Mon Feb 23 13:38:21 2009 +0100
+++ b/src/store/elephant/elephant.lisp Tue Feb 24 17:51:52 2009 -0500
@@ -85,7 +85,7 @@
(defmethod dynamic-transaction ((store elephant-store) proc)
"This dynamic hook wraps an elephant transaction macro around the
body hooks.
This allows us to gain the benefits of the stable transaction
system in elephant"
- (ensure-transaction (:store-controller store)
+ (ensure-transaction (:store-controller (elephant-controller store))
(funcall proc)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -144,7 +144,7 @@
(catch 'finish-map
(cond (filter-fn
(range-objects-in-memory
- (weblocks-memory::advanced-order-objects-in-memory
+ (advanced-order-objects-in-memory
(filter-objects-in-memory
(get-instances-by-class class-name)
filter-fn)
@@ -167,7 +167,7 @@
:collect t)))
((consp order-by)
(range-objects-in-memory
- (weblocks-memory::advanced-order-objects-in-memory
+ (advanced-order-objects-in-memory
(get-instances-by-class class-name)
order-by)
range))
@@ -187,6 +187,31 @@
(push object results))))
(mapc #'filter-if objects)
(nreverse results)))
+
+(defun advanced-order-objects-in-memory (seq order-by)
+ "Orders objects in 'seq' according to 'order-by'."
+ (cond ((not order-by)
+ seq)
+ ((not (consp (first order-by)))
+ (weblocks-memory::order-objects-in-memory seq order-by))
+ (t
+ (stable-sort seq (multi-value-sort-predicate-asc order-by)))))
+
+(defun multi-value-sort-predicate-asc (order-by)
+ (let ((query-records
+ (mapcar #'(lambda (rec)
+ (destructuring-bind (slot-fn . dir) rec
+ (cons (curry-after #'slot-value-by-path slot-fn)
+ dir)))
+ order-by)))
+ (lambda (a b)
+ (loop for (accessor . dir) in query-records do
+ (let ((a-value (funcall accessor a))
+ (b-value (funcall accessor b)))
+ (if (eq dir :asc)
+ (weblocks-memory::strictly-less-p a-value b-value)
+ (and (not (weblocks-memory::strictly-less-p a-value b-value))
+ (not (weblocks-memory::equivalentp a-value b-value)))))))))
(defmethod count-persistent-objects ((store elephant-store) class-name
&key filter-fn &allow-other-keys)
diff -r cd83809dfadc src/utils/misc.lisp
--- a/src/utils/misc.lisp Mon Feb 23 13:38:21 2009 +0100
+++ b/src/utils/misc.lisp Tue Feb 24 17:51:52 2009 -0500
@@ -238,19 +238,19 @@
"Constructs a relative path to a public file from the \"/pub\"
directory.
'type' - currently either :stylesheet or :script
-'filename' the name of the file
+'filename' the name of the file or 'reldir/filename'
Ex:
\(public-file-relative-path :stylesheet \"navigation\")
=> #P\"stylesheets/navigation.css\""
- (make-pathname :directory `(:relative
- ,(ecase type
- (:stylesheet "stylesheets")
- (:script "scripts")))
- :name filename
- :type (ecase type
- (:stylesheet "css")
- (:script "js"))))
+ (merge-pathnames (make-pathname :defaults filename)
+ (make-pathname :directory `(:relative
+ ,(ecase type
+ (:stylesheet "stylesheets")
+ (:script "scripts")))
+ :type (ecase type
+ (:stylesheet "css")
+ (:script "js")))))
(defun public-files-relative-paths (&rest args)
"A helper function that returns a list of paths for files provided