flexx icon indicating copy to clipboard operation
flexx copied to clipboard

Pyscript double quote transpiling

Open Maxyme opened this issue 9 years ago • 3 comments

I encountered an issue where a default property was set like this:

        @event.prop
        def default_label(self, value=""):
            return str(value)

And the value shown in the client side was "Null" while I was expecting an empty string. Setting the quote to single quotes style solved the issue:

        @event.prop
        def default_label(self, value=''):
            return str(value)

A possible fix would be to force all quotes, double and single to transpile to single quotes.

Maxyme avatar Dec 05 '16 08:12 Maxyme

This is slightly frightening.

almarklein avatar Dec 05 '16 10:12 almarklein

I cannot reproduce it though. What do you mean by "the value shown in the client side"?

from flexx import app, ui, event

class Example(ui.Widget):
    
    class JS:
        
        @event.prop
        def default_label1(self, value=''):
            return str(value)
        
        @event.prop
        def default_label2(self, value=""):
            return str(value)

m = app.launch(Example, 'firefox')

almarklein avatar Dec 05 '16 11:12 almarklein

Sorry, this one was a mistake in my code, I tested it extensively and can confirm that it's the same. I will close this one.

Maxyme avatar Dec 05 '16 12:12 Maxyme