cenkalti / kuyruk

⚙️ Simple task queue for Python
https://kuyruk.readthedocs.org/
MIT License
234 stars 17 forks source link

Enhanced `Config.from_object` so it can handle a string object as an object name to import #47

Closed frol closed 8 years ago

frol commented 8 years ago

Having this PR, you can pass a string to Config.from_object and it will be imported and loaded:

import kuyruk

k = kuyruk.Kuyruk()
k.config.from_object('config.DevelopmentConfig')

This is how it is implemented in Flask, and since I have noticed quite a similarity to Flask design, I decided to make them closer in terms of my use-case.

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.9%) to 82.386% when pulling 4621c7069ace85628df07a2e149a6911767eeea9 on frol:patch-4 into 3d312fd191b141ef3fdb0f9ecae3d52ffa0ec160 on cenkalti:master.

cenkalti commented 8 years ago

@frol I have refactored it little bit, I hope it is okay: https://github.com/cenkalti/kuyruk/commit/428e15a22ad8d1345c9252ddc4e94b1a96e881a0

frol commented 8 years ago

@cenkalti Oh, I haven't noticed the importer module... I am sorry for this hacking. Thank you for fixing it!