2001-06-09
2001-06-09 02:39:44 by Martin Nilsson <mani@lysator.liu.se>
-
3704fa9308c632f51df6387831fc4e26e62d6e2b
(18 lines)
(+10/-8)
[
Show
| Annotate
]
Branch: 5.2
The documentation for eval_args was not entierly true. It does affect attributes not listed in req_arg_types and opt_arg_types. Added argument ignore_args where one can list attributes that must not be touched, e.g. because they are not strings and would cause a backtrace should they be evaluated again.
Rev: server/etc/modules/RXML.pmod/module.pmod:1.163
1:
- // $Id: module.pmod,v 1.162 2001/06/09 00:33:24 mast Exp $
+ // $Id: module.pmod,v 1.163 2001/06/09 02:39:44 nilsson Exp $
// Kludge: Must use "RXML.refs" somewhere for the whole module to be
// loaded correctly.
271:
return frame;
}
- int eval_args (mapping(string:mixed) args, void|int dont_throw, void|Context ctx)
+ int eval_args (mapping(string:mixed) args, void|int dont_throw,
+ void|Context ctx, void|array(string) ignore_args)
//! Parses and evaluates the tag arguments according to
//! @[req_arg_types] and @[opt_arg_types]. The @[args] mapping
//! contains the unparsed arguments on entry, and they get replaced
//! by the parsed results. Arguments not mentioned in
- //! @[req_arg_types] or @[opt_arg_types] are not touched. RXML
- //! errors, such as missing argument, are thrown if @[dont_throw] is
- //! zero or left out, otherwise zero is returned when any such error
- //! occurs. @[ctx] specifies the context to use; it defaults to the
- //! current context.
+ //! @[req_arg_types] or @[opt_arg_types] are evaluated with the default
+ //! argument type, unless listed in @[ignore_args]. RXML errors, such
+ //! as missing argument, are thrown if @[dont_throw] is zero or left
+ //! out, otherwise zero is returned when any such error occurs. @[ctx]
+ //! specifies the context to use; it defaults to the current context.
{
// Note: Code duplication in Frame._eval_args and Frame._prepare.
mapping(string:Type) atypes = args & req_arg_types;
297: Inside #if defined(MODULE_DEBUG)
#ifdef MODULE_DEBUG
if (mixed err = catch {
#endif
- foreach (indices (args), string arg)
+ foreach (indices (args) - ( ignore_args||({}) ), string arg)
args[arg] = (atypes[arg] || def_arg_type)->eval (
args[arg], ctx); // Should not unwind.
#ifdef MODULE_DEBUG