Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't access kwarg assets_folder of dash_extensions.javascript.Namespace.dump #267

Open
araichev opened this issue Jun 19, 2023 · 4 comments

Comments

@araichev
Copy link

The above issue caused me a difficult-to-fix permissions error on my server, and i had to result to monkey patching to fix it.
Would be easier if one could somehow configure the dump, assign, etc. functions to use a custom assets folder path.

@emilhe
Copy link
Owner

emilhe commented Jun 21, 2023

What do you think would be the prefered solution for this feature request? Some kind of auto detection of the assets folder used - or simply an (optional) argument to specify the assets folder?

@araichev
Copy link
Author

Thanks for your response @emilhe.
Maybe you can follow both approaches.
But i would at least start by using as a default path the assets folder path set by the user in the DashProxy object.
That will probably cover most use cases, including mine.

One way to do that is to move the assets_folder kwarg out of the dump method and into an attribute of the Namespace class, make dump reference that attribute, and set the attribute's value during instantiation (in line 56) to the assets folder path set in the DashProxy object.

Alternatively or additionally, you could give the user finer control of target directories by exposing the assets_folder kwarg in the assign function.
But that might be overkill.

Hope that helps.
Sorry i'm not familiar enough with the Dash Extension library to convert my suggestion above into a pull request.

@emilhe
Copy link
Owner

emilhe commented Jun 23, 2023

Could your intention be realised via the optional assets_folder kwarg of the dump function?

https://github.com/thedirtyfew/dash-extensions/blob/2bf9f451b6a448473384d54b22f825cfdf816fcf/dash_extensions/javascript.py#L32

@araichev
Copy link
Author

Yes, but that kwarg is not accessible from the user-facing assign function.
Also, it seems more natural for that kwarg to default to the location of the assets folder set when instantiating a DashProxy object.
As it stands, if i set a custom assets folder when creating a DashProxy, it's not honoured by the assign function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants