Different behavior from Pharo and Gemstone

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Different behavior from Pharo and Gemstone

dtrussardi@tiscali.it
Ciao,

i have this code into Pharo 4.0 Seaside 3.1

renderDbAnchorIncrementVoce: aVoceCompilata index: anIndexRow  nominative: nominative on:html 
" DataBase TableData row increment "
| flagDialog dialogId  |
flagDialog:= false.
html anchor
onClick:( html jQuery script:[ :script |
          script << (JSStream on: 'this.onclick = function(){ return false; }').
script << html jQuery ajax
  callback:[ flagDialog := false.
  [ masterView increaseVoce: aVoceCompilata ]
on: DTRError do:[:ex | masterView exception: ex.
flagDialog := true.
(ex isMemberOf: DTRStockError)
ifTrue:[ dialogId :=  #stockErrorDialogId ]
ifFalse:[ dialogId := #genericErrorDialogId]]];
onComplete: ( html jQuery ajax script: [ :s |
flagDialog 
ifTrue:[ s << (s  jQuery: dialogId ) dialog open ]
ifFalse:[ s << (s jQuery: #'idVoceAttiva') load
                            html: [ :h | self masterView renderVoceAttivaOn: h ].
self updateRow: anIndexRow with: aVoceCompilata on: html nominative: nominative script: s ]])]);
with: [ html image
url:  DTRFileLibrary / #greenupGif ;
altText: 'Incrementa';
title:'Incrementa']

It works fine into Pharo :

the ajax callback update the data:  [ masterView increaseVoce: aVoceCompilata ]

and if error is detected setup some variables used into onComplete: code to display a relative dialog open.

But this code run in GLASS ( Gemstone 3.3.6 )  Seaside 3.1  don't works.

As if the variables used in the onComplete: code are not updated to what is done in the callback.

So even if an error is detected, the relative dialog is not displayed.

Considerations?

Thanks,

Dario

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Different behavior from Pharo and Gemstone

Johan Brichau-2
Hi Dario,

This sounds like a known bug in GemStone when using temporary variables in separate callbacks with the same lexical scope.

What you can do to work around this is to not assign directly to the variable but wrap the value in a holder. 
For example:

dialogId := ValueHolder new.

and in your callback use:

dialogId value: xxx

and

dialogId value

to assign and retrieve the value.

Does this work for you?

cheers,
Johan


On 6 May 2018, at 11:02, [hidden email] wrote:

Ciao,

i have this code into Pharo 4.0 Seaside 3.1

renderDbAnchorIncrementVoce: aVoceCompilata index: anIndexRow  nominative: nominative on:html 
" DataBase TableData row increment "
| flagDialog dialogId  |
flagDialog:= false.
html anchor
onClick:( html jQuery script:[ :script |
          script << (JSStream on: 'this.onclick = function(){ return false; }').
script << html jQuery ajax
  callback:[ flagDialog := false.
  [ masterView increaseVoce: aVoceCompilata ]
on: DTRError do:[:ex | masterView exception: ex.
flagDialog := true.
(ex isMemberOf: DTRStockError)
ifTrue:[ dialogId :=  #stockErrorDialogId ]
ifFalse:[ dialogId := #genericErrorDialogId]]];
onComplete: ( html jQuery ajax script: [ :s |
flagDialog 
ifTrue:[ s << (s  jQuery: dialogId ) dialog open ]
ifFalse:[ s << (s jQuery: #'idVoceAttiva') load
                            html: [ :h | self masterView renderVoceAttivaOn: h ].
self updateRow: anIndexRow with: aVoceCompilata on: html nominative: nominative script: s ]])]);
with: [ html image
url:  DTRFileLibrary / #greenupGif ;
altText: 'Incrementa';
title:'Incrementa']

It works fine into Pharo :

the ajax callback update the data:  [ masterView increaseVoce: aVoceCompilata ]

and if error is detected setup some variables used into onComplete: code to display a relative dialog open.

But this code run in GLASS ( Gemstone 3.3.6 )  Seaside 3.1  don't works.

As if the variables used in the onComplete: code are not updated to what is done in the callback.

So even if an error is detected, the relative dialog is not displayed.

Considerations?

Thanks,

Dario
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Different behavior from Pharo and Gemstone

dtrussardi@tiscali.it
Ciao Johan,



Hi Dario,

This sounds like a known bug in GemStone when using temporary variables in separate callbacks with the same lexical scope.

What you can do to work around this is to not assign directly to the variable but wrap the value in a holder. 
For example:

dialogId := ValueHolder new.

and in your callback use:

dialogId value: xxx

and

dialogId value

to assign and retrieve the value.

Does this work for you?

Yes. 

But ValueHolder don't know: value and  value:   methods.

I need to use:  contents   and  contents: 

Do you agree?
Very thanks,

Dario


cheers,
Johan


On 6 May 2018, at 11:02, [hidden email] wrote:

Ciao,

i have this code into Pharo 4.0 Seaside 3.1

renderDbAnchorIncrementVoce: aVoceCompilata index: anIndexRow  nominative: nominative on:html 
" DataBase TableData row increment "
| flagDialog dialogId  |
flagDialog:= false.
html anchor
onClick:( html jQuery script:[ :script |
          script << (JSStream on: 'this.onclick = function(){ return false; }').
script << html jQuery ajax
  callback:[ flagDialog := false.
  [ masterView increaseVoce: aVoceCompilata ]
on: DTRError do:[:ex | masterView exception: ex.
flagDialog := true.
(ex isMemberOf: DTRStockError)
ifTrue:[ dialogId :=  #stockErrorDialogId ]
ifFalse:[ dialogId := #genericErrorDialogId]]];
onComplete: ( html jQuery ajax script: [ :s |
flagDialog 
ifTrue:[ s << (s  jQuery: dialogId ) dialog open ]
ifFalse:[ s << (s jQuery: #'idVoceAttiva') load
                            html: [ :h | self masterView renderVoceAttivaOn: h ].
self updateRow: anIndexRow with: aVoceCompilata on: html nominative: nominative script: s ]])]);
with: [ html image
url:  DTRFileLibrary / #greenupGif ;
altText: 'Incrementa';
title:'Incrementa']

It works fine into Pharo :

the ajax callback update the data:  [ masterView increaseVoce: aVoceCompilata ]

and if error is detected setup some variables used into onComplete: code to display a relative dialog open.

But this code run in GLASS ( Gemstone 3.3.6 )  Seaside 3.1  don't works.

As if the variables used in the onComplete: code are not updated to what is done in the callback.

So even if an error is detected, the relative dialog is not displayed.

Considerations?

Thanks,

Dario
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Different behavior from Pharo and Gemstone

Mariano Martinez Peck
Yes. #contents 

On Sun, May 6, 2018, 10:51 AM [hidden email] <[hidden email]> wrote:
Ciao Johan,



Hi Dario,

This sounds like a known bug in GemStone when using temporary variables in separate callbacks with the same lexical scope.

What you can do to work around this is to not assign directly to the variable but wrap the value in a holder. 
For example:

dialogId := ValueHolder new.

and in your callback use:

dialogId value: xxx

and

dialogId value

to assign and retrieve the value.

Does this work for you?

Yes. 

But ValueHolder don't know: value and  value:   methods.

I need to use:  contents   and  contents: 

Do you agree?
Very thanks,

Dario


cheers,
Johan


On 6 May 2018, at 11:02, [hidden email] wrote:

Ciao,

i have this code into Pharo 4.0 Seaside 3.1

renderDbAnchorIncrementVoce: aVoceCompilata index: anIndexRow  nominative: nominative on:html 
" DataBase TableData row increment "
| flagDialog dialogId  |
flagDialog:= false.
html anchor
onClick:( html jQuery script:[ :script |
          script << (JSStream on: 'this.onclick = function(){ return false; }').
script << html jQuery ajax
  callback:[ flagDialog := false.
  [ masterView increaseVoce: aVoceCompilata ]
on: DTRError do:[:ex | masterView exception: ex.
flagDialog := true.
(ex isMemberOf: DTRStockError)
ifTrue:[ dialogId :=  #stockErrorDialogId ]
ifFalse:[ dialogId := #genericErrorDialogId]]];
onComplete: ( html jQuery ajax script: [ :s |
flagDialog 
ifTrue:[ s << (s  jQuery: dialogId ) dialog open ]
ifFalse:[ s << (s jQuery: #'idVoceAttiva') load
                            html: [ :h | self masterView renderVoceAttivaOn: h ].
self updateRow: anIndexRow with: aVoceCompilata on: html nominative: nominative script: s ]])]);
with: [ html image
url:  DTRFileLibrary / #greenupGif ;
altText: 'Incrementa';
title:'Incrementa']

It works fine into Pharo :

the ajax callback update the data:  [ masterView increaseVoce: aVoceCompilata ]

and if error is detected setup some variables used into onComplete: code to display a relative dialog open.

But this code run in GLASS ( Gemstone 3.3.6 )  Seaside 3.1  don't works.

As if the variables used in the onComplete: code are not updated to what is done in the callback.

So even if an error is detected, the relative dialog is not displayed.

Considerations?

Thanks,

Dario
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside