• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Look at the recent changes listing this topic's summary field containing $ nop, $ quot, $ percnt, $ dollar (space added since they get expanded). They get expanded, which is a bug. They should only expand if specified in the header="" and format="", not if found inside a $formfield().

Also reproducable here with a SEARCH on itself:

Topic Summary
Item2837 Edit and FormattedSearch expands $nop, $quot, $percnt, $dollar in $formfield()

-- PTh

I am raising this to requirement since content in formfields gets destroid:

  • 'dollar'-nop disappears on edit
  • 'dollar'-percnt, 'dollar'-dollar gets expanded on edit
  • content after a 'dollar'-quot is lost

-- PTh

Sounds like the call to expandStandardEscapes in Search.pm needs to be moved up a few lines. Though I am surprised by this, as IIRC that call simply replaced a bunch of individual RE's that did the same thing.....

CC


expandStandardEscapes is a good hint, though it is not (only) Search.pm what is affected: See PTh's initial comment, even a simple edit is enough. It is too late for me to get it fixed tonight, but I think I've narrowed it to one of the many commits for Item2905. CC wrote that this is thin ice, and indeed it is. Here's part of the story:

Index: lib/TWiki/Form.pm
===================================================================
--- lib/TWiki/Form.pm   (Revision 12257)
+++ lib/TWiki/Form.pm   (Arbeitskopie)
@@ -386,10 +386,11 @@
                 if( defined( $value )) {
                     $value = $session->handleCommonTags( $value, $web,
                                                          $topic );
+                    $value = TWiki::expandStandardEscapes( $value ); # Item2837
                 }
             }
             $value = '' unless defined $value;  # allow 0 values
-           $value = TWiki::expandStandardEscapes( $value );
+           # $value = TWiki::expandStandardEscapes( $value ); # Item2837
             ( $extra, $value ) =
               $this->renderFieldForEdit( $fieldDef, $web, $topic, $value );

This is in sub renderForEdit. Currently, expandStandardEscapes is called unconditionally. But it may be called only if the data come from the form definition or template topic, but not if they come from form data. The fix is partial because it handles the case where the form definition is consulted, but fails to expand the escapes when data from a template topic have to be expanded.

HJ


Looks good now, or at least: Test cases pass. Instead of expanding standard escapes once unconditionally, it has to be done separately for each of the possible sources of initialisations:

  1. Initialisation per query param in Form.pm, sub getFieldValuesFromQuery
  2. Initialisation per template topic in Edit.pm, sub init_edit.
  3. Initialisation per form topic in Form.pm, sub renderForEdit.

Since I am not very familiar with form initialisation: Please test and break as you can. I added one more test case for "don't expand anything when editing a topic containing a form".

HJ


Still not done - at least the problem in SEARCH seems to persist. Seems to need more testcases to nail down, since save is broken as well. HJ


Now (r12281) this item survives edit/view, and search is ok. Testcases pass. Use at own risk smile

HJ

Excellent, thanks Harald for nailing this down!

-- PTh

4.1.0 released

KJL

ItemTemplate
Summary Edit and FormattedSearch expands $nop, $quot, $percnt, $dollar in $formfield()
ReportedBy TWiki:Main.PeterThoeny
Codebase ~twiki4
SVN Range TWiki-4.1-beta1, Tue, 29 Aug 2006, build 11384
AppliesTo Engine
Component

Priority Urgent
CurrentState Closed
WaitingFor

Checkins 12279 12280 12281
TargetRelease minor
Edit | Attach | Watch | Print version | History: r14 < r13 < r12 < r11 < r10 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r14 - 2007-01-16 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback