Overview
Comment: | Fixed bad return from formdat initialization when there is no form. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | stml2 |
Files: | files | file ages | folders |
SHA1: |
60c715f8f7ef55707c1213b071f4ef52 |
User & Date: | matt on 2018-09-09 16:35:11 |
Other Links: | branch diff | manifest | tags |
Context
2018-09-09
| ||
16:44 | Fixed s:if-{param,session-var} calls to return null list for safe processing of stml pages. check-in: 30a1c2e2d2 user: matt tags: stml2 | |
16:35 | Fixed bad return from formdat initialization when there is no form. check-in: 60c715f8f7 user: matt tags: stml2 | |
12:52 | Pulled sugar.scm into stml2.scm check-in: 4856914104 user: matt tags: stml2 | |
Changes
Modified stml2.scm from [ac0b204ddd] to [34b13cb01a].
︙ | ︙ | |||
957 958 959 960 961 962 963 | ;; ;; New data format is only the <formdat> portion from above ;; (define-class <formdat> () ;; (form-data ;; )) (define (make-formdat:formdat)(vector (make-hash-table))) | | | | 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 | ;; ;; New data format is only the <formdat> portion from above ;; (define-class <formdat> () ;; (form-data ;; )) (define (make-formdat:formdat)(vector (make-hash-table))) (define (formdat:formdat-get-data vec) (vector-ref vec 0)) (define (formdat:formdat-set-data! vec val)(vector-set! vec 0 val)) (define (formdat:initialize self) (formdat:formdat-set-data! self (make-hash-table))) (define (formdat:get self key) (hash-table-ref/default (formdat:formdat-get-data self) |
︙ | ︙ | |||
1093 1094 1095 1096 1097 1098 1099 | (define formdat:delim-patt-rex (regexp "^\\-+[0-9]+\\-*$")) ;; returns a hash with entries for all forms - could well use a proplist? (define (formdat:load-all) (let ((request-method (get-environment-variable "REQUEST_METHOD"))) (if (and request-method (string=? request-method "POST")) | | > | 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 | (define formdat:delim-patt-rex (regexp "^\\-+[0-9]+\\-*$")) ;; returns a hash with entries for all forms - could well use a proplist? (define (formdat:load-all) (let ((request-method (get-environment-variable "REQUEST_METHOD"))) (if (and request-method (string=? request-method "POST")) (formdat:load-all-port (current-input-port)) (make-formdat:formdat)))) ;; (s:process-cgi-input (caaar dat)) (define (formdat:load-all-port inp) (let* ((formdat (make-formdat:formdat)) (debugp #f)) ;; (open-output-file (conc "/tmp/delme-" (current-user-id) ".log")))) ;; (write-string (read-string #f inp) #f debugp) ;; destroys all data! |
︙ | ︙ | |||
1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | ;; (print "datstr: " datstr " munged: " munged) (if (and (not (null? alldats)) (not (null? (car alldats))) (not (null? (caar alldats)))) (formdat:load formdat (s:process-cgi-input (caaar alldats))))) ;; munged)) ;; (format debugp "formdat : name: ~A content: ~A\n" name content) (if debugp (close-output-port debugp)) formdat)))) #| (define inp (open-input-file "tests/example.post.in")) (define dat (read-string #f inp)) (define datstr (open-input-string dat)) | > | 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 | ;; (print "datstr: " datstr " munged: " munged) (if (and (not (null? alldats)) (not (null? (car alldats))) (not (null? (caar alldats)))) (formdat:load formdat (s:process-cgi-input (caaar alldats))))) ;; munged)) ;; (format debugp "formdat : name: ~A content: ~A\n" name content) (if debugp (close-output-port debugp)) ;; (sdat-formdat-set! s:session formdat) formdat)))) #| (define inp (open-input-file "tests/example.post.in")) (define dat (read-string #f inp)) (define datstr (open-input-string dat)) |
︙ | ︙ | |||
2081 2082 2083 2084 2085 2086 2087 | (let* ((fp (open-input-file name)) (initargs (read fp))) (close-input-port fp) initargs)))) ;; call the controller if it exists ;; | | | 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 | (let* ((fp (open-input-file name)) (initargs (read fp))) (close-input-port fp) initargs)))) ;; call the controller if it exists ;; ;; WARNING - this code needs a defense agains recursive calling!!!!! ;; ;; I suggest a limit of 100 calls. Plenty for allowing multiple instances ;; of a page inside another page. ;; ;; parts = 'both | 'control | 'view ;; |
︙ | ︙ | |||
2312 2313 2314 2315 2316 2317 2318 | (car params))) (tags (if (null? params) '() (cdr params))) (formdat (sdat-formdat self)) (res (if (not formdat) #f (if (or (string? key)(number? key)(symbol? key)) | | > > | 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 | (car params))) (tags (if (null? params) '() (cdr params))) (formdat (sdat-formdat self)) (res (if (not formdat) #f (if (or (string? key)(number? key)(symbol? key)) (if (and (vector? formdat) (eq? (vector-length formdat) 1) (hash-table? (vector-ref formdat 0))) (formdat:get formdat key) (begin (session:log self "ERROR: formdat: " formdat " is not of class <formdat>") #f)) (begin (session:log self "ERROR: bad key " key) #f))))) |
︙ | ︙ |