Advertisement
Guest User

Untitled

a guest
May 1st, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. (defun update-post (post &key (title nil title-supplied-p)
  2. (path nil path-supplied-p))
  3. (let ((errors '()))
  4. (progn
  5. (when title-supplied-p
  6. (if (post-title-p title)
  7. (setf (slot-value post 'title) title)
  8. (setf errors (acons 'title "Invalid title" errors))))
  9. (when path-supplied-p
  10. (if (post-path-p path)
  11. (setf (slot-value post 'path) path)
  12. (setf errors (acons 'path "Invalid path" errors))))
  13. (if (equal errors '())
  14. (handler-case (mito:save-dao post)
  15. (t (c)
  16. (format t "Caught condition: ~A" c)
  17. (values nil '(( update_failure . "Persisting changes to DB failed")))))
  18. (values nil errors))
  19. (values t '()))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement