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

Add Support for Storing Values as Strings in the Database #8

Merged
merged 8 commits into from Jul 1, 2014

Conversation

bltravis
Copy link
Contributor

This will add the ability to specify (at runtime) whether you would like to save MACs as strings (varchar) or integers (bigint) via an "integer" keyword (defaults to True, i.e. existing behavior). I've also reworked how to specify a default dialect (via a settings variable and a utility function that handles importing it), and added a function to format any given EUI instance via a specified mac_eui48 subclass. I know that my change to how a default dialect is set is backwards-incompatible, but I think it's more elegant solution than using a class method.

@kra3
Copy link
Member

kra3 commented Jun 29, 2014

I'll have a look in this week & Thanks for keeping mac address in strings. (which will help in more easy searching.)
I believe it's done on top of latest release of this repo and String mode doesn't break Admin Search.

Also, I've to check anyone who might have using MACAddressField.set_dialect isn't left behind.

@bltravis
Copy link
Contributor Author

I'm going to have a crack at adding support for the select_dialect class method (with a deprecation warning of future removal (v1.4?)) and I'll push that to my repo when it's done, and get it added to this pull request.

@bltravis
Copy link
Contributor Author

And, there it is. That last commit should re-enable the existing set_dialect class method, and adds a deprecation warning that the feature will be removed in the next release. The warning is issued whenever the field class is first called, and the first time default_dialect returns MACAddressField.dialect. By default, MACAddressField.dialect is now None, and my original default behavior for default_dialect is followed (settings-supplied class or mac_linux). If set_dialect is used, then default_dialect returns that value.

Resolved Conflicts:
	macaddress/__init__.py
	setup.py
@bltravis
Copy link
Contributor Author

Went ahead and merged in this repository's master into mine to make merging this request easier.

… the package. The previous code didn't actually return anything and would break if not installed via setup.py.
@kra3
Copy link
Member

kra3 commented Jun 30, 2014

Thanks a lot @bltravis for your support and passion. 👍
I'm travelling today, so will be merging the change sets probably by tomorrow or day after that.
Hope you can wait till then

Conflicts:
	macaddress/__init__.py
	setup.py
@bltravis
Copy link
Contributor Author

bltravis commented Jul 1, 2014

Merged from upstream to make it easy to merge into the main repository.

kra3 added a commit that referenced this pull request Jul 1, 2014
Add Support for Storing Values as Strings in the Database
@kra3 kra3 merged commit 1624520 into django-macaddress:master Jul 1, 2014
@kra3
Copy link
Member

kra3 commented Jul 1, 2014

Done & Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants