remove closer-mop dependency
Thu Jun 26 17:07:44 PDT 2008 Ryszard Szopa <ryszard.szopa@gmail.com>
* remove closer-mop dependency
diff -rN -u old-cl-couch/cl-couchdb-object-layer.asd new-cl-couch/cl-couchdb-object-layer.asd
--- old-cl-couch/cl-couchdb-object-layer.asd 2014-09-21 23:10:43.000000000 -0700
+++ new-cl-couch/cl-couchdb-object-layer.asd 2014-09-21 23:10:43.000000000 -0700
@@ -6,7 +6,7 @@
(defsystem cl-couchdb-object-layer
:name "cl-couchdb-object-layer"
:version "0.0.1"
- :depends-on (:iterate :cl-json :cl-couchdb-client :defclass-star :cl-ppcre :closer-mop)
+ :depends-on (:iterate :cl-json :cl-couchdb-client :defclass-star :cl-ppcre)
:serial t
:components ((:file "cl-couchdb-object-layer")
(:module "object-layer"
diff -rN -u old-cl-couch/object-layer/validated-document.lisp new-cl-couch/object-layer/validated-document.lisp
--- old-cl-couch/object-layer/validated-document.lisp 2014-09-21 23:10:43.000000000 -0700
+++ new-cl-couch/object-layer/validated-document.lisp 2014-09-21 23:10:43.000000000 -0700
@@ -1,38 +1,14 @@
(in-package :cl-couchdb-object-layer)
-(export '(validated-doc invalid-document constraints-of validators-of validates defdoc make-doc make-doc* make-doc-and-save make-doc-and-save* bless-doc))
+(export '(validated-doc invalid-document constraints-of validators-of constraint-failed validates defdoc make-doc make-doc* make-doc-and-save make-doc-and-save* bless-doc))
-(defclass* validated-doc-class (standard-class)
- ((validators (make-alist) :documentation "Alist indexed by attribute
- names (keywords), whose values are one argument
- functions. An object is valid if every validator called
- on its attribute returns true. Each attribute can have
- many validators.")
- (constraints nil)
- (default-db nil :documentation "Default db to which the document
- should be saved."))
- (:documentation "A metaclass for validated-doc classes. Class
- allocated slots just didn't do the job."))
-
-(defmethod closer-mop:validate-superclass ((class validated-doc-class) (super standard-class))
- t)
(defclass* validated-doc (doc)
()
- (:metaclass validated-doc-class)
(:documentation "A more sophisticated version of
`document'. Allows to define validators and initforms for document
attributes."))
-(defmethod constraints-of ((doc validated-doc))
- (constraints-of (class-of doc)))
-
-(defmethod validators-of ((doc validated-doc))
- (validators-of (class-of doc)))
-
-(defmethod default-db-of ((doc validated-doc))
- (default-db-of (class-of doc)))
-
(defcondition* invalid-document ()
(doc))
@@ -113,12 +89,23 @@
`(progn
(let ((class (defclass ,name (validated-doc)
()
- (:metaclass validated-doc-class)
,@(when (@ options :documentation)
(list (assoc :documentation options))))))
- (setf (validators-of class) (list ,@validators)
- (constraints-of class) (list ,@(@ options :constraints))
- (default-db-of class) ,(car (@ options :default-db)))
+
+ (defmethod validators-of ((doc ,name))
+ "Alist indexed by attribute names (keywords), whose values
+ are one argument functions. An object is valid if every
+ validator called on its attribute returns true. Each
+ attribute can have many validators."
+ (list ,@validators))
+
+ (defmethod constraints-of ((doc ,name))
+ (list ,@(@ options :constraints)))
+
+ (defmethod default-db-of ((doc ,name))
+ "Default db to which the document should be saved."
+ ,(car (@ options :default-db)))
+
class)
(defmethod make-doc* ((cl (eql ',name)) attributes)
(apply 'make-doc cl (alist-plist attributes)))