One of my users wanted to have a list of all attachments from another web.
Lists of attachments can be done with FormQueryPlugin, which, however, always is acting on the web from where it is being used.
No problem, I thought, let's build the attachment list in the web where the attachments are using FQP, and then pull this list in with INCLUDE.
However, this doesn't work: TWiki throws an internal error:
TWiki detected an internal error - please check your TWiki logs and webserver logs for more information.
Can't call method "formQuery" on an undefined value
In the Apache logfile I see a line saying:
Can't call method "formQuery" on an undefined value at /home/httpd/twiki/lib/TWiki/Plugins/FormQueryPlugin.pm line 77
Reason:
In
FormQueryPlugin.pm
, (most) callers of the initialisation routine
_lazyInit
pass the web where the FQP tag occurs. The routine, however, ignores the parameter, thus falls back to the global variable with the same name
$web
. This global variable gets its value from
initPlugin
and thus from the base topic.
So
_lazyInit
initializes the wrong database.
Fix:
Just pick the web which is passed to
lazyInit