HBNetwork / python-decouple

Strict separation of config from code.
MIT License
2.83k stars 196 forks source link

Casting list of tuples #118

Closed mahsa-kh-21 closed 3 years ago

mahsa-kh-21 commented 3 years ago

I need to cast a list of tuples ADMINS = [ ('admin1','example1@example.com'), ('admin2','example2@example.com'), ] and this is what I've tried:

ADMINS = config('ADMINS', cast=Csv(post_process=tuple))

I get this upon calling django.core.mail.mail_admins():

The ADMINS setting must be a list of 2-tuples.
henriquebastos commented 3 years ago

You will need to implement your own post_process function to convert a list of items to a list of pairs.

Em seg., 6 de set. de 2021 às 10:44, mahsa-kh-21 @.***> escreveu:

I need to cast a list of tuples ADMINS = [ @.'), ('admin2',' @.'), ] and this is what I've tried:

ADMINS = config('ADMINS', cast=Csv(post_process=tuple))

I get this upon calling django.core.mail.mail_admins():

The ADMINS setting must be a list of 2-tuples.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/henriquebastos/python-decouple/issues/118, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAC6IQKUY4SX4SODQL6XD3UATAUNANCNFSM5DQPYG5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

--

Henrique Bastos http://henriquebastos.net/ Muito além da programação! https://henriquebastos.net/produtos/

Instagram https://instagram.com/henriquebastosnet, Youtube https://www.youtube.com/henriquebastosnet, Facebook https://www.facebook.com/henriquebastos +55 21 99618-6180 https://hbn.link/whatsapp-duvida

mahsa-kh-21 commented 3 years ago

Thanks for replying. I will look into it and update this issue if I came up with anything .

hypsug0 commented 2 years ago

@mahsa-kh-21, did you code this post_process function? I have the same ask. Thanks