fredrik-corneliusson / click-web

Serve click scripts over the web
MIT License
266 stars 17 forks source link

web_click_types.py isn't getting executed #2

Closed JayBigGuy10 closed 5 years ago

JayBigGuy10 commented 5 years ago

as seen here EMAIL_TYPE = EmailParamType() needs to be executed in the users program as this is what allows the user to select EMAIL_TYPE as an input type

this is because web_click_types is only being imported by input_feilds

some part of the click web program needs to set this variable

fredrik-corneliusson commented 5 years ago

Thanks for the feedback! You can import the instantiated (executed) EMAIL_TYPE directly from click_web.web_click_types. https://github.com/fredrik-corneliusson/click-web/blob/36c973ce373091df68483d2c9598f788608f1b95/click_web/web_click_types.py#L20

See the example command that does this: https://github.com/fredrik-corneliusson/click-web/blob/36c973ce373091df68483d2c9598f788608f1b95/example/example_command.py#L7

I've tried to follow the pattern click does for its types that do not take arguments INT,FLOAT etc. https://github.com/pallets/click/blob/c16ff82166736748407c2fb00d4de34abc1a10ee/click/types.py#L657

Could you check if importing and using EMAIL_TYPE type solves the issue?

JayBigGuy10 commented 5 years ago

Hello, due to time zones I got this at 10pm. This morning I have removed the EMAIL_TYPE = EmailParamType() and from click_web.web_click_types import EmailParamType

replacing them with from click_web.web_click_types import EMAIL_TYPE still yields the desired result

Thanks!