Wapp

Check-in [f9a0146ed6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add routines wapp-set-param, wapp-param-exists, and wapp-param-list which together eliminate the need to access the global ::wapp dict.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f9a0146ed662bbb71767a80cdccdc2e88ef5d2091aaf1e734d20b08df6dc67ba
User & Date: drh 2018-01-30 19:07:46.453
Context
2018-01-30
19:09
Use 307 instead of 302 to redirect. (check-in: d8cc844e83 user: drh tags: trunk)
19:07
Add routines wapp-set-param, wapp-param-exists, and wapp-param-list which together eliminate the need to access the global ::wapp dict. (check-in: f9a0146ed6 user: drh tags: trunk)
17:28
Support the -Dvariable=value option to set global TCL variables. (check-in: 6fa89b7c98 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to wapp.tcl.
220
221
222
223
224
225
226






















227
228
229
230
231
232
233
# Return the value of a query parameter or environment variable.
#
proc wapp-param {name {dflt {}}} {
  global wapp
  if {![dict exists $wapp $name]} {return $dflt}
  return [dict get $wapp $name]
}























# Examine the bodys of all procedures in this program looking for
# unsafe calls to "wapp".  Return a text string containing warnings.
# Return an empty string if all is ok.
#
# This routine is advisory only.  It misses some constructs that are
# dangerous and flags others that are safe.







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# Return the value of a query parameter or environment variable.
#
proc wapp-param {name {dflt {}}} {
  global wapp
  if {![dict exists $wapp $name]} {return $dflt}
  return [dict get $wapp $name]
}

# Return the value of a query parameter or environment variable.
#
proc wapp-param-exists {name} {
  global wapp
  return [dict exists $wapp $name]
}

# Set the value of a parameter
#
proc wapp-set-param {name value} {
  global wapp
  dict set wapp $name $value
}

# Return all parameter names that match the GLOB pattern, or all
# names if the GLOB pattern is omitted.
#
proc wapp-param-list {{glob {*}}} {
  global wapp
  return [dict keys $wapp $glob]
}

# Examine the bodys of all procedures in this program looking for
# unsafe calls to "wapp".  Return a text string containing warnings.
# Return an empty string if all is ok.
#
# This routine is advisory only.  It misses some constructs that are
# dangerous and flags others that are safe.