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

implementing __int__() to allow casting PrefProxy to int #11

Closed
wants to merge 1 commit into from

Conversation

yoandym
Copy link

@yoandym yoandym commented Apr 23, 2015

Please accept my change based on:

If i from setttings import my_var and my my_var was originally an integer value i would like to use it without asking if it's a PrefProxy instance and calling .get_value() on it.

It would be better if could just do int(my_var)

If i'm just using django-siteprefs in the wrong way or there is a better solution just let me know,

thanks.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.12%) to 65.92% when pulling b9c479e on yoandym:master into 669ed99 on idlesign:master.

@idlesign
Copy link
Owner

The are two problems:

First one is that we still need to cast implicitly (this one may probably be cured with definition of other special methods for numeric types)

Second is that int and co must return an appropriate type else TypeError is raised, yet get_value() won't guarante that.

There probably is a better way to mimic int and other types. Need to think it over. If you have any ideas, you're welcome.

@landscape-bot
Copy link

Code Health
Code quality remained the same when pulling b9c479e on yoandym:master into 669ed99 on idlesign:master.

Repository owner deleted a comment from coveralls May 30, 2018
Repository owner deleted a comment from coveralls May 30, 2018
Repository owner deleted a comment from coveralls May 30, 2018
@idlesign
Copy link
Owner

idlesign commented Oct 2, 2018

This and other type mimic methods are available in 0.8.1
Closing this.

@idlesign idlesign closed this Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants