pyramid_celery icon indicating copy to clipboard operation
pyramid_celery copied to clipboard

safely convert ini parameters to bool, int, list and dict

Open kgk opened this issue 11 months ago • 6 comments

This will convert ini paramerts to bool or int if they can be.
Allows for max_tasks_per_child to be set as well as others for celery workers

fixes : https://github.com/sontek/pyramid_celery/issues/103

kgk avatar Mar 20 '24 17:03 kgk

The latest push adds json5 as safely converted value.. json5 is a human friendly json parser (accepts both ' and " ) and other things. I could also use a python AST parser if you prefer

kgk avatar May 23 '24 18:05 kgk

I feel literal_eval is better solution.

  1. Will only evaluate python literals .. no arbitrary code execution
  2. No new dependencies.

kgk avatar May 24 '24 03:05 kgk

I agree, ast.literal_eval is a better approach.

fmigneault avatar May 24 '24 15:05 fmigneault

Just a ping to check if the patch is accepted

kgk avatar Jul 16 '24 21:07 kgk

@kgk I also didn't get any answer from @sontek with #102. It seems we will never get an official release... If you want, I can add it to the list of combined improvements as a crim-ca/[email protected] version.

fmigneault avatar Jul 17 '24 19:07 fmigneault

@fmigneault please add to your list

kgk avatar Jul 20 '24 06:07 kgk