On Oct 3, 2008, at 12:18 PM, Sergiu Dumitriu wrote:

> Pascal Voitot wrote:
>> OK,
>> I don't have solved everything but I have found the origin of the
>> stackoverflow...
>> I coded a Recursive VelocityMacro and apparently variables inside  
>> VM macro
>> are not local and it makes my recursion infinite!!!
>> Apparently, there is an option in velocity to make local macro  
>> variables
>> have only a local scope. Do you see any problem about this?
>
> Yes, I had my share of pain with the fact that variables defined  
> inside
> macros are global... I am +1 for making them local, but all the macros
> should be checked, since some of them might use this "feature".

Velocity Macros *are* local (i.e. we're using the local macro  
configuration option from Velocity).

           <property>
             <name>velocimacro.permissions.allow.inline.local.scope</ 
name>
             <value>true</value>
           </property>

However for the include feature of XWiki Syntax 1.0 to work we have a  
hack in the velocity module to allow macros to span more than 1  
document.
This is not required for the XWiki Syntax 2.0 (AFAIR) but we need it  
for the 1.0 syntax to continue working.

Thanks
-Vincent

>> I have modified my dbstringlist SQL query to use only one column to  
>> be sure
>> this is the easiest case...
>> I then add a listitem manually to the list property of the object  
>> in my
>> velocity script. Everything is OK but sometimes the list item  
>> appears in the
>> object editor, sometimes not and i don't understand why yet!
>
> It should always be there. The code says that if the selected item is
> not in the list obtained from the DB, then it is manually added at  
> the end.
>
>> Still investigating!
>>
>> best regards
>> PAscal
>>
>> On Thu, Oct 2, 2008 at 6:22 PM, Pascal Voitot
>> <[EMAIL PROTECTED]>wrote:
>>
>>> plz see below
>>>
>>> thks
>>> Pascal
>>>
>>> On Thu, Oct 2, 2008 at 6:01 PM, Sergiu Dumitriu <[EMAIL PROTECTED]>  
>>> wrote:
>>>
>>>> Pascal Voitot wrote:
>>>>> hello guys,
>>>>> I do the following:
>>>>> - I have a class with a DBStringList property "mylist"
>>>>> - In a velocity script, I do:
>>>>> #set($obj = $doc.getObject("MyClass", $mynb)
>>>>>
>>>>> #set($mylist = $obj.get("mylist"))
>>>>> #set($mylist = "${mylist}|${mynewlistitem}")
>>>>> #set($ret = $obj.set("mylist", $mylist))
>>>>>
>>>>> #set($ret = $doc.save())
>>>>>
>>>>> - I run this script and I can see in the DB that "mynewlistitem"  
>>>>> was
>>>> added
>>>>> as listitem to "mylist" but the item doesn't appear in the  
>>>>> object editor
>>>> for
>>>>> property "mylist" in my document.
>>>>> - Moreover, I get some rendering exception in contentview.vm  
>>>>> when I try
>>>> to
>>>>> access this object in other velocity scripts.
>>>>> - When I create the link using the Object editor, then  
>>>>> everything works
>>>> well
>>>>> but I don't see anything different in the DB from the previous  
>>>>> state.
>>>>>
>>>>> - I have tried the same with:
>>>>> #set($obj = $doc.getObject("MyClass", $mynb)
>>>>>
>>>>> #set($mylist = $obj.getProperty("mylist").getValue())
>>>>> #set($ret = $mylist.add("${mynewlistitem}"))
>>>>>
>>>>> #set($ret = $doc.save())
>>>>>
>>>>> same result...
>>>>>
>>>>> It seems the Object property is saved but it is not taken into  
>>>>> account
>>>> by
>>>>> the object in the document.
>>>>>
>>>>> Do you any clue for me?
>>>>>
>>>> - is the property multiselect? relational storage?
>>>
>>> multiselect relation storage
>>>
>>>> - would the mynewlistitem value be returned by the DB search? Or  
>>>> is it a
>>>> new value you want to include manually?
>>>
>>> in Object editor, I use the DB search to return this value (which  
>>> is stored
>>> in DB) plus another string (which is the displayed value)
>>>
>>> select myvalue, mystring from ...
>>>
>>> In my velocity script, I had this value manually directly  
>>> accessing the
>>> property... But after that, I verify it has been stored using the  
>>> Object
>>> editor...
>>>
>>>
>>>> - does the DB query normally return one or two values?
>>>
>>> 2 values
>>>
>>>
>>>> - what exactly is the error you receive?
>>>
>>> I don't have it here now but this is a kind of StackOverflow in
>>> getRenderedContent()
>>>
>>> I will search with the debugger if you don't have any quick  
>>> idea... In
>>> fact, as my property is well stored in the DB (I have verified  
>>> manually), I
>>> don't see the wrong interaction between this property and its  
>>> object in this
>>> case... what's different between accessing the property from the  
>>> object
>>> editor or from my velocity script?
>
>
> -- 
> Sergiu Dumitriu
> http://purl.org/net/sergiu/
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to