answer.lisp 27.4 KB
Newer Older
1
;;
2
;; Copyright 2002-2011 Genworks International 
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
;;
;; This source file is part of the General-purpose Declarative
;; Language project (GDL).
;;
;; This source file contains free software: you can redistribute it
;; and/or modify it under the terms of the GNU Affero General Public
;; License as published by the Free Software Foundation, either
;; version 3 of the License, or (at your option) any later version.
;; 
;; This source file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; Affero General Public License for more details.
;; 
;; You should have received a copy of the GNU Affero General Public
;; License along with this source file.  If not, see
;; <http://www.gnu.org/licenses/>.
;; 


(in-package :gwl)

(defparameter *f-e-p* nil)

Dave Cooper's avatar
Dave Cooper committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

(define-object session-control-mixin ()
  
  :documentation (:description "Mixin to the root object of the part which you wish to have session control over"
                  :author "Brian Sorg, Liberating Insight LLC (revised Dave Cooper, Genworks)")
  
  :input-slots
  (("Universal time after which the session should expire" 
    expires-at nil :settable)
   
   ("Length of time a session should last without activity in minutes"
    session-duration 20)

   ("Boolean. Determines whether expired sessions are replaced by recovery object. Default is nil."
    use-recovery-object? nil)
   
   ("Expiration time of the recovery object. After the recovery object has replaced the orginal 
instance at what time should the recovery instance expire?"
    recovery-expires-at (+ (get-universal-time) (* 60 (the session-duration))))
   
   ("Url to which a user will be redirected if requesting a session that has been cleared"
    recovery-url *recovery-url-default*)
   
   ("Type of original object, useful when viewing session report log"
    org-type (type-of self))
      
   (;; For future use
    %state-plist% '(0)))
  
  :functions
  (("This is the function called to check for and handle session control
:&key ((debug? nil) \"Boolean. Prints debug statement if needed\")" 
    clear-expired-session
    (&key debug?)
    (when debug?
     (format t "Validating instance ~a~% of class ~a~% Current Universal Time: ~a.~% Expiration Time: ~a.~% Clear now? ~a.~%"
                (the instance-id)
                (class-of self)
                (get-universal-time)
                (the expires-at)
                (the (clear-now?))))
    (when (the clear-now?)
      (the (session-clean-up))
      (glisp:w-o-interrupts (clear-instance (the instance-id))
        (when (and (the use-recovery-object?) (the recovery-expires-at))
          (let ((recovery (make-object 'session-recovery 
                                       :instance-id (the instance-id)
                                       :expires-at (the recovery-expires-at)
                                       :recovery-url (the recovery-url)
                                       :state-plist (the %state-plist%)
                                       :org-type (the org-type))))
            (setf (gethash (make-keyword (the instance-id)) *instance-hash-table*) 
                  ;;
                  ;; FLAG -- that last entry is actually supposed to be the skin class.
                  ;;
                  (list recovery (list 0) t)))))))
   ("Gets called right before the instance is going to get cleared. Is intended to be used to stop any instance states that may not be elequently handled by the garbage collector. ie database connections, multiprocessing locks, open streams etc."
    session-clean-up
    ())
      
   ("Boolean. Test to run to see if this session has expired and needs to be cleared now."
    clear-now?
    () (when (the expires-at) (> (get-universal-time) (the expires-at))))
   
   ("Method which will set the expires-at slot to the current time + the session-duration"
    set-expires-at
    (&optional (duration (the session-duration)))
    (the (set-slot! :expires-at (+ (get-universal-time) (* 60 duration)))))))



(define-object session-recovery (session-control-mixin)
  
  :input-slots
  (instance-id ))



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
(defun answer (req ent)
  (let ((query (request-query req)))
    
    (when *debug?* (format t "before multi-part processing, query is: ~s~%" query))
    
    (when (null query) (setq query (process-multipart-submission req)))
    
    (when gwl::*debug?* (print-variables query))
    
    
    (let* ((requestor (query-arg-to-root-path query "requestor"))
           (iid (make-keyword 
                 (rest (assoc "iid" query :test #'string-equal))))
           (hash-entry (gethash iid *instance-hash-table*))
           (root-object (first hash-entry)) (skin (third hash-entry))
           (recovery-object? (typep root-object 'session-recovery))
           (requestor (when (and root-object (not recovery-object?)) 
                        (the-object root-object 
                                    (follow-root-path requestor))))
           (bashee (when requestor (the-object requestor bashee)))
           (rest-plist (when (not recovery-object?)
                         (merge-plist-duplicates
                          (assoc-list-to-plist 
                           (remove-if 
                            #'(lambda(item) 
                                (member (first item) 
                                        (list "requestor" "iid") 
                                        :test #'string-equal)) query) 
                           :case-sensitive? t))))
           (possible-nils (when (not recovery-object?) 
                            (the-object requestor possible-nils)))
           (rest-plist (when requestor 
                         (append rest-plist 
                                 (mapcan #'(lambda(key) (list key nil)) 
                                         (set-difference possible-nils
                                                         (plist-keys rest-plist))))))
           (settables (when bashee (the-object bashee %settable-slots%)))
           (rest-keys (plist-keys rest-plist))
           (query-plist (mapcan #'(lambda(key) (list key (getf rest-plist key)))
144
                                (remove-if #'(lambda(key) (gethash (make-keyword-sensitive key) settables)) rest-keys))))
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
      
      
      
      (let ((respondent (the-object requestor respondent)))
        
        (the-object respondent root (set-remote-host! req))
      
        (unless (the-object respondent root do-security-check)
          (with-http-response (req ent)
            (setf (reply-header-slot-value req :cache-control) "no-cache")
            (setf (reply-header-slot-value req :pragma) "no-cache")
                     
            (with-http-body (req ent)
              (let ((*req* req) (*ent* ent))
                (the-object respondent root security-check-failed write-html-sheet))))
          (return-from answer nil)))
        
      
      (when gwl::*debug?* (print-variables query 
                                           requestor 
                                           iid 
                                           hash-entry 
                                           root-object 
                                           recovery-object?
                                           requestor 
                                           bashee 
                                           rest-plist 
                                           possible-nils
                                           settables 
                                           rest-keys 
                                           query-plist))
      
      (let ((fe-processor (make-object 'form-element-processor 
                                       :bashee bashee 
                                       :query-plist query-plist)))
        
        (cond (recovery-object? (with-http-response (req ent :response *response-moved-permanently*)
                                  (setf (reply-header-slot-value req :location)
                                    (defaulting (the-object root-object recovery-url) *failed-request-url*))
                                  (setf (reply-header-slot-value req :cache-control) "no-cache")
                                  (setf (reply-header-slot-value req :pragma) "no-cache")
                                  (with-http-body (req ent))))
              ((null requestor) (net.aserve::failed-request req))
              (t (let ((*query-plist* query-plist) (*field-plist* rest-plist)) 
                   (the-object requestor (before-set!)))
              
191
                 ;;(when *debug?* (print-variables *query-plist* rest-plist rest-keys))
192

193
                 (when *debug?* (setq *f-e-p* fe-processor))
194
195
                 
                 (dolist (key rest-keys)
196
197
198
                   (when (gethash (make-keyword-sensitive key) settables)
                     ;;(when *debug?* (print-variables key))
                     (the-object bashee (set-slot-if-needed! (make-keyword-sensitive key) (getf rest-plist key)))))
199
200
201
202
203
                 
                 (the-object fe-processor validate-and-set!)
                 
                 (when 
                     (and (fboundp 'process-graphics-fields)
204
                          (typep (the-object requestor) (read-from-string "gwl:base-html-graphics-sheet"))
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
                          (the-object requestor (evaluate :view-object)))
                   (setq query-plist (funcall (read-from-string "gwl::process-graphics-fields")
                                              query query-plist root-object requestor)))


                 (when (not (equalp (the-object bashee query-plist) query-plist))
                   (the-object bashee 
                               (set-slot! :query-plist query-plist 
                                          :remember? (not (member :query-plist 
                                                                  (the-object bashee transitory-slots))))))
      
                 (let ((result (let ((*req* req) (*ent* ent) (*skin* skin) 
                                     (*query* query)) (the-object requestor (after-set!)))))
                   
                   (let ((respondent (if (and (consp result) (eql (first result) :go-to)) (second result)
                                       (the-object requestor respondent))))
                     ;;
                     ;; Dashboard stuff
                     ;;
                     ;;
                     ;; FLAG - use actual application-root rather than simple root.
                     ;;
                     (when (typep root-object 'session-control-mixin) (the-object root-object (set-expires-at)))
                     (the-object respondent root (set-time-last-touched!))
                     
                     (the-object respondent root (set-slot! :last-visited-root-path 
                                                            (the-object respondent root-path)))
                     ;;
                     ;;
                     ;;
                   
Dave Cooper's avatar
Dave Cooper committed
236
                     (with-http-response (req ent :response *response-found*)
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
                       (setf (reply-header-slot-value req :cache-control) "no-cache")
                       (setf (reply-header-slot-value req :pragma) "no-cache")
                     
                       (setf (reply-header-slot-value req :location) (the-object respondent url))
                     
                       (let ((keys (plist-keys (the-object respondent header-plist)))
                             (values (plist-values (the-object respondent header-plist))))
                         (mapc #'(lambda(key val)
                                   (setf (reply-header-slot-value req key) val)) keys values))

                       (with-http-body (req ent)
                         (let ((*req* req) (*ent* ent) (*skin* skin))
                           (multiple-value-bind (check error)
                               (when (the-object respondent check-sanity?)
                                 (ignore-errors (the-object respondent check-sanity)))
                             (declare (ignore check))
                             (if error (the-object respondent (sanity-error error)))))))))))))))


(defun process-multipart-submission (req)
  (let (sep query 
        (directory 
         (glisp:temporary-folder)))
    (do ()(nil)
      (multiple-value-bind (kind name filename content-type)
          (parse-multipart-header (get-multipart-header req))
        (declare (ignorable content-type))
        (when filename
          (setq sep (max (or (position #\/ filename :from-end t) -1) (or (position #\\ filename :from-end t) -1)))
          (setq filename (subseq filename (1+ sep) (length filename))))
        
        
        (case kind
          (:eof (return query))
          (:data (push (cons name (get-all-multipart-data req)) query))
          (:file (let ((output-path (merge-pathnames filename directory)))
                   (push (cons name (format nil "~a" output-path)) query)
                   (with-open-file (out output-path :direction :output
                                    :if-exists :supersede :element-type '(unsigned-byte 8))
                     
                     (let ((buffer (make-array 4096 :element-type '(unsigned-byte 8))))
                       (do ()(nil)
                         (let ((count (get-multipart-sequence req buffer)))
                           (when (null count) (return))
                           (write-sequence buffer out :end count))))))))))))





(defun make-object-internal (req ent)
  (let ((query (request-query req)))
    (let ((part (rest (or (assoc "object" query :test #'string-equal)
                          (assoc "part" query :test #'string-equal)))))
      (gwl-make-part req ent part))))


294
(defun gwl-make-part (&rest args) (apply 'gwl-make-object args))
295
296
297
298
299
300
301
302
303
304
305
306

(defparameter *weak-objects* (glisp:make-weak-hash-table))


(defmethod restore-ui-object ((ui-server gwl-gdl-ui) object)
  
  (when (typep object 'base-html-sheet)
    (format t "~&Restoring GWL UI status for ~s...~%" object)
    ;;
    ;; FLAG -- handle skins
    ;;
    (let* ((instance-id (the-object object instance-id))
307
           (current (gethash (make-keyword-sensitive instance-id) *instance-hash-table*))
308
309
310
311
312
313
314
315
316
           (root-part-and-version (list object *dummy-version*)))
      (setf (gethash (first root-part-and-version) *weak-objects*) t)
      (when current
        (warn "Instance ID of restored object, ~a, is already in use. Generating new instance id..." instance-id)
        (setq instance-id (make-new-instance-id))
        (format t "~&New Instance ID is: ~a~%" 
                (progn (the-object object (set-slot! :instance-id instance-id))
                       (the-object object instance-id))))
      (the-object (first root-part-and-version) url)
317
      (setf (gethash (make-keyword-sensitive instance-id) *instance-hash-table*) root-part-and-version))))
318
319
320
321


(defun %gwl-make-object% (part &key make-object-args share? skin)
  (let* ((instance-id (if share? "share" (make-new-instance-id)))
322
         (current (gethash (make-keyword-sensitive instance-id) *instance-hash-table*))
323
324
325
326
327
328
329
330
331
         (skin (if skin (make-instance skin) t))
         (root-part-and-version 
          (if (or (not share?) (not current))
              (list (apply #'make-object (read-safe-string part)
                           :instance-id instance-id
                           make-object-args) *dummy-version*) current)))
    (setf (gethash (first root-part-and-version) *weak-objects*) t)
    (setq root-part-and-version (append root-part-and-version (list skin)))
    (when (or (not share?) (not current))
332
      (setf (gethash (make-keyword-sensitive instance-id) *instance-hash-table*) root-part-and-version))
333
334
335
    (first root-part-and-version)))
  

336
337
(defun gwl-make-object (req ent part &key make-object-args share? skin 
				       (instance-id (if share? "share" (make-new-instance-id))))
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
  "Void. Used within the context of the body of a :function argument to Allegroserve's 
publish function, makes an instance of the specified part and responds to the request 
with a redirect to a URI representing the instance.

:arguments (req \"Allegroserve request object, as used in the function of a publish\"
            ent \"Allegroserve entity object, as used in the function of a publish\"
            package-and-part \"String. Should name the colon- (or double-colon)-separated 
package-qualified object name\")

:&key ((make-object-args nil) \"Plist of keys and values. These are passed to the object upon instantiation.\"
       (share? nil) \"Boolean. If non-nil, the instance ID will be the constant string ``share'' rather than a real instance id.\")

:example <pre>
  (publish :path \"/calendar\"
           :function #'(lambda(req ent) (gwl-make-object req ent \"calendar:assembly\")))
  </pre>"
  (let ((query (request-query req)))
355
356
357
358
359
360
361
362
    (let* ((part (or part (rest (assoc "part" query :test #'string-equal))))
	   (part-type (read-safe-string part))
	   (session-urls? (assoc "session-urls" query :test #'string-equal))
	   (path (format nil "~a/~a" (package-name (symbol-package part-type))
				       part-type)))
      
      (print-variables session-urls? query)

363
      (let* ((current (gethash (make-keyword-sensitive instance-id) *instance-hash-table*))
364
365
366
             (skin (if skin (make-instance skin) t))
             (root-part-and-version 
              (if (or (not share?) (not current))
367
368
369
370
		  (list (apply #'make-object  part-type
			       :instance-id instance-id ;;:query-toplevel query 
			       :use-cookie? (not session-urls?)
			       :fixed-url-prefix (unless session-urls? path)
371
			       make-object-args)
372
373
374
375
376
377
			*dummy-version*)
		  current)))
	(setf (gethash (first root-part-and-version) *weak-objects*) t)
	(setq root-part-and-version (append root-part-and-version (list skin)))
	(when (or (not share?) (not current)) 
	  (setf (gethash (make-keyword-sensitive instance-id) *instance-hash-table*) root-part-and-version))
378
        
379
380
381
382
383
384
	(let ((object (first root-part-and-version)))
	  (when (typep object 'session-control-mixin)
	    (the-object object set-expires-at))
	  (the-object object set-instantiation-time!)
	  (the-object object set-time-last-touched!)
	  (the-object object (set-remote-host! req :original? t)))
385
        
386
387
388
389
390
391
392
393
394
395
	(with-http-response (req ent :response *response-found*)
	  (setf (reply-header-slot-value req :location)
		(format nil "~a" (the-object (first root-part-and-version) url)))
	  (unless session-urls?
	    (set-cookie-header req :name "iid" 
			       :path (format nil "/~a" path)
			       :value instance-id))
	  (setf (reply-header-slot-value req :cache-control) "no-cache")
	  (setf (reply-header-slot-value req :pragma) "no-cache")
	  (with-http-body (req ent)))))))
396
397
398


(defun publish-shared (&key path object-type host (server *wserver*)
399
                       (key (make-keyword-sensitive path)))
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
    "Void. Used to publish a site which is to have a shared toplevel instance tree,  
and no URI rewriting (i.e. no \"/sessions/XXX/\" at the beginning of the path). So,
this site will appear to be a normal non-dynamic site even though the pages are
being generated dynamically. 

:&key ((path nil) \"String. The URI path to be published.\"
       (object-type nil) \"Symbol. The type of the toplevel object to be instantiated.\"
       (host nil) \"hostname for the URI to be published.\"
       (server *wserver*) \"Allegroserve server object. If you have additional servers other than the default
<tt>*wserver*</tt> (e.g. an SSL server) you may want to call this function for each server.\")

:example <pre>
  (publish-shared :path \"/\"
                  :object-type 'site:assembly
                  :host (list \"www.genworks.com\" \"ww2.genworks.com\" \"mccarthy.genworks.com\"))
  </pre>"

  (let ((object (make-object (if (stringp object-type)
                                 (read-safe-string object-type)
                                 object-type)
                             :instance-id key
                             :plain-url? t
                             :host host)))
    (setf (gethash key *instance-hash-table*) (list object))
    
    (publish :path path
             :server server
             :host host
428
	     :content-type "text/html"
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
             :function #'(lambda(req ent)
                         (let ((*req* req) (*ent* ent)
                               (object (first (gethash key *instance-hash-table*))))
                           (with-http-response (req ent)
                             (setf (reply-header-slot-value req :cache-control) "no-cache")
                             (setf (reply-header-slot-value req :pragma) "no-cache")
                             (with-http-body (req ent)
                               (the-object object write-html-sheet))))))))






(define-object form-element-processor ()
  :input-slots
  (bashee query-plist)

  
  :computed-slots
  (
   (form-element-objects (the bashee form-controls))
   
   (force-validation-for (the bashee force-validation-for))
   
   (form-element-keys (mapcar #'(lambda(object) (the-object object field-name))
                              (the form-element-objects)))
   
   (radios (mapcan 
            #'(lambda(key)
Dave Cooper's avatar
Dave Cooper committed
459
                (when (and (glisp:match-regexp "^radio-" (string-downcase (format nil "~a" key)))
460
                           (string-equal (second (getf (the query-plist) key)) "true"))
461
                  (list (make-keyword-sensitive (glisp:replace-regexp
Dave Cooper's avatar
Dave Cooper committed
462
463
464
465
						 (glisp:replace-regexp 
						  (glisp:replace-regexp  (format nil "~a" key) "^RADIO-" "")
						  "^radio-" "")
						 "-.*" ""))
466
467
468
469
                        (first (getf (the query-plist) key)))))
                   (plist-keys (the query-plist))))
   
   (query-plist-all 
470
471
    (append (the radios) 
	    (mapcan #'(lambda(key val)
Dave Cooper's avatar
Dave Cooper committed
472
473
			(unless (or (glisp:match-regexp "^radio-" (string-downcase (format nil "~a" key)))
				    (glisp:match-regexp "-checkedp$" (string-downcase (format nil "~a" key))))
474
475
476
			  (list key val)))
		    (plist-keys (the query-plist))
		    (plist-values (the query-plist)))))
477
478
479
   
   (checked-booleans 
    (mapcan #'(lambda(key)
Dave Cooper's avatar
Dave Cooper committed
480
                (when (glisp:match-regexp "-checkedp$" (string-downcase (format nil "~a" key )))
481
                  (list 
Dave Cooper's avatar
Dave Cooper committed
482
483
484
                   (make-keyword-sensitive (glisp:replace-regexp
					    (glisp:replace-regexp (format nil "~a" key ) "-checkedp$" "")
					    "-CHECKEDP$" ""))
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
                   (let ((checked (getf (the query-plist) key)))
                     (not (string-equal checked "false"))))))
            (plist-keys (the query-plist))))


   (form-elements-to-bash%
     (let ((submitted-elements 
            (let* ((query-plist-keys (plist-keys (the query-plist-all)))

                   ;;
                   ;; Comment out this #+nil and uncomment the one below to switch to
                   ;; 1579p007 behavior (i.e. ability to have form-element from
                   ;; anywhere in the tree). This really should be the correct
                   ;; behavior. 
                   ;;
                   (keys (remove-if-not #'(lambda(key) 
                                            ;; FLAG -- check for value
                                            ;; form-control object for
                                            ;; each key
                                            ;;
                                            (typep 
                                             (ignore-errors 
                                              (the bashee root
                                                   (follow-root-path 
                                                    (base64-decode-list (string key))))) 'base-form-control))
                                        query-plist-keys))

                   ;;
                   ;;
514
                   #+nil
515
516
517
                   (keys (remove-if-not #'(lambda(key) 
                                            (find key query-plist-keys))
                                        (the form-element-keys))))
518
	      
519
520
521
522
523
              (mapcan #'(lambda(key) (list key 
                                           (if (member key (the checked-booleans))
                                               (getf (the checked-booleans) key)
                                             (getf (the query-plist-all) key))))
                      keys))))
524
525
526
527
528
529
530
531
532
533
       
       (let ((result
	      (append submitted-elements
		      (mapcan #'(lambda(object) (list (the-object object field-name)
						      (the-object object value)))
			      (remove-if #'(lambda(objct)
					     (member (the-object objct field-name)
						     (plist-keys submitted-elements)))
					 (ensure-list (the force-validation-for)))))))
	 result)))
534
   
535

536
   (form-elements-to-bash (the form-elements-to-bash%))
537
538

   #+nil
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
   (form-elements-to-bash (mapcan #'(lambda(key val)
                                      ;;
                                      ;; The comparison of old and new should work, to avoid unneeded
                                      ;; bashing when the old and new values are the same. 
                                      ;;
                                      (let (#+nil
                                            (new (getf
                                                  (the bashee root (follow-root-path
                                                                    (base64-decode-list (string key))) 
                                                       (validate-type val)) :typed-value))
                                            #+nil
                                            (old (the bashee root (follow-root-path
                                                                      (base64-decode-list (string key))) value)))
                                        
                                        ;;(unless (equalp new old) (list key val))
                                        
                                        (list key val)
                                        
                                        ))
                                  (plist-keys (the form-elements-to-bash%))
                                  (plist-values (the form-elements-to-bash%)))))
  
  :functions
  ((validate-and-set!
    ()

    (dotimes (n 2)
      (dolist (key (plist-keys (the form-elements-to-bash)))
        
        (let ((*out-of-bounds-sequence-reference-action* :silent))
          (let ((element (the bashee root (follow-root-path (base64-decode-list (string key))))))
            (when element
              (unless (eql (first (the-object element root-path)) :%delete-button%)
                (when (or (= n 1) (the bashee preset-all?) (the-object element preset?))
                  (the-object element (validate-and-set! (getf (the form-elements-to-bash) key))))))))))
    
    (dolist (key (plist-keys (the form-elements-to-bash)))
      (let ((*out-of-bounds-sequence-reference-action* :silent))
        (let ((element (the bashee root (follow-root-path (base64-decode-list (string key))))))
          (when element
            (when *debug?* (print-variables (the-object element root-path)))
            (when (eql (first (the-object element root-path)) :%delete-button%)
              (the-object element parent aggregate (delete! (the-object element parent index)))))))))))